Replies: 17 comments 2 replies
-
You don't need to define the I'm wondering if this section is relevant, have you seen it?: https://next-auth.js.org/providers/apple#testing Aside from that, any good reason for using |
Beta Was this translation helpful? Give feedback.
-
@balazsorban44 About useSecureCookies, I use it for testing only. |
Beta Was this translation helpful? Give feedback.
-
@balazsorban44 I think it related to this lines. Because I see that the callback cookies has reset to baseUrl when navigating from apple authorize page to my website. next-auth/src/server/lib/callback-url-handler.js Lines 27 to 30 in 71f6311 |
Beta Was this translation helpful? Give feedback.
-
I had similar issues with azureb2c, this might offer a temporary alternative for testing until issue is fixed 👇🏾 |
Beta Was this translation helpful? Give feedback.
-
I also have the same issue with apple login. I have the same login flow with facebook , google , which run ok but only apple doesn't.. |
Beta Was this translation helpful? Give feedback.
-
I was able to fix the issue in azureb2c by adjusting the response_mode value in the AuthorizationUrl from form_post to query Examples : Hope this helps |
Beta Was this translation helpful? Give feedback.
-
Thank you @innowhat for the workaround, worked fine with Apple. However setting the |
Beta Was this translation helpful? Give feedback.
-
I'm experiencing this issue too. |
Beta Was this translation helpful? Give feedback.
-
Hi @KristenWilde, I have never used apple as a provider so cant really tell if the work around applies there as well. Here is an example of how it could look like, hope this helps.
Note: this only applies to next-auth4 or later |
Beta Was this translation helpful? Give feedback.
-
From my experience the |
Beta Was this translation helpful? Give feedback.
-
Thanks @FernandVEYRIER and @innowhat! I am using an older version of next-auth, but it was easy to change the
This worked for signing in and redirecting, but unfortunately my app doesn't work without the user's name and email. |
Beta Was this translation helpful? Give feedback.
-
We got the Apple redirect working by changing the cookie config for the callbackUrl.
(still using next-auth version 3). |
Beta Was this translation helpful? Give feedback.
-
@KristenWilde Thank you! I think this fixed the root cause of the issue: missing cookies on a request coming in from https://appleid.apple.com/ to /api/auth/callback/apple. Before adding your cookie config to next-auth options, that request looked like this (no cookies):
and after (with callback-url cookie):
This cookie value is then used as a redirect url, and user is successfully redirected to the path specified in signIn call:
And this is how my NextAuthOptions looks like now:
Before finding out this fix I was going to submit the pull request where I added callbackUrl in NextAuthOptions. Then this callbackUrl would be used instead of url.origin as fallback in case when there is no callbackUrl in cookies, body or query params in requests coming in to /api/auth/callback/. |
Beta Was this translation helpful? Give feedback.
-
I tested locally. It seems using onClick={() => {
signIn( 'apple',
{ callbackUrl: "https://<your-redirect-url>" },
{ redirect_uri: "https://<your-redirect-url>" });
}} Edit: But not works if you don't apply |
Beta Was this translation helpful? Give feedback.
-
Still having this problem |
Beta Was this translation helpful? Give feedback.
-
Still facing the issue for apple provider next : 12.1.6 |
Beta Was this translation helpful? Give feedback.
-
Is it fixed in any latest release? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description 🐜
When I sign in with apple or google I want to navigate back to current page (the page when click sigin button).
It's work with google and but when I sign in with apple, it's always navigate to home page.
Hope that everyone can help me fix this bug. Thank you so much.
How to reproduce ☕️
Here is the next-auth config

And the function handle signin.


Environment 🖥
"next-auth": "^3.25.0",
"next": "^10.2.0",
System:
OS: macOS 11.4
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 363.25 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 91.0.4472.77
Safari: 14.1.1
Beta Was this translation helpful? Give feedback.
All reactions