-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apple OAuth2 example doesn't work #248
Comments
I've no good experience on implementing Apple login. So, I can't really help much. A PR to fix the example would be amazing. |
Hi @mcollina, thanks for the reply. Do you have any idea why Plugin checks this at Line 26 in f9c4a5c
getAccessTokenFromAuthorizationCodeFlow function
If I can fix it, I can contribute a clean PR. Regards, |
A cookie is empty if it's not set or the origin is different. In this case 127.0.0.0 and localhost are not equivalent. How do you access the server? |
There is frontend server vite proxying from |
fastify-oauth2/examples/apple.js Line 44 in f9c4a5c
Here maybe post |
Prerequisites
Fastify version
4.26.1
Plugin version
7.8.0
Node.js version
v20.6.1
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10
Description
I created the issue, so that it clarifies the issue or helps other people.
I had to make changes to make the example work.
examples/apple.js
Explicitly setting scope to empty (otherwise undefined error)
scope: [], //'name', 'email'
, when I set scope apple returns POST form-urlencoded. That is documented in the example and Github issues. It might be nice to provide an example for that case as well.const { code, state, error, user } = request.query
instead ofrequest.body
Wher does
Error.CancelledAuth
comes from? It is undefined so it has wrong logic when error is also undefined.The part I didn't understand:
request.cookies['oauth2-redirect-state']
this is empty, however the cookie is set in browser dev tools.Readme states, "Since v7.2.0, @fastify/oauth2 requires the use of cookies to securely implement the OAuth2 exchange." It is after this example is updated on the repo.
Steps to Reproduce
Create a new project
npm init fastify
and tryexamples/apple.js
exampleExpected Behavior
No response
The text was updated successfully, but these errors were encountered: