Replies: 1 comment
-
Hi! Were you able to fix this issue? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have setup the next auth for Next js 14. I have no issues at all, but when I use an iphone to access website, i cannot get logged in at all in IOS safari.
I dont have any special configuration for the cookies, everything works fine on ios chrome or android
export const authOptions = (req?: NextApiRequest, res?: NextApiResponse) =>
({
pages: {
signIn: "/signin",
verifyRequest: "/verify-request", // (used for check email message)
},
session: {
strategy: "jwt",
},
jwt: {
secret: env.NEXTAUTH_SECRET,
},
callbacks: {
async signIn({ user, account, profile, email, credentials }) {
return true;
},
async redirect({ url, baseUrl }) {
// Allows relative callback URLs
if (url.startsWith("/")) return
${baseUrl}${url}
;// Allows callback URLs on the same origin
else if (new URL(url).origin === baseUrl) return url;
return baseUrl;
},
async session({ session, user, token }) {
const encodedJWT = jsonwebtoken.sign(
token,
process.env.NEXTAUTH_SECRET
);
return { ...session, accessToken: encodedJWT };
},
async jwt({ token, user, account, profile, isNewUser }) {
return token;
},
},
providers: [
DiscordProvider({
clientId: env.DISCORD_CLIENT_ID,
clientSecret: env.DISCORD_CLIENT_SECRET,
}),
EmailProvider({
server: process.env.EMAIL_SERVER,
from: process.env.EMAIL_FROM,
}),
],
adapter: ApiAdapter(),
} as NextAuthOptions);
export const getServerAuthSession = (ctx: {
req: GetServerSidePropsContext["req"];
res: GetServerSidePropsContext["res"];
}) => {
// @ts-ignore
return getServerSession(ctx.req, ctx.res, authOptions(ctx.req, ctx.res));
};
I dont have any special configs here, pretty much the out of the box config. I have checked some of the older threads, and they all allude to setting secure:false, but from what I have seen, they were handing custom cookies, I just want the default NextAuth session Cookie to work, no modification (if possible)
has anyone encountered not being able to sign into their web app for IOS Safari? Any advice would be great
Beta Was this translation helpful? Give feedback.
All reactions