Skip to content
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

Add support for OAuth 2.0 State #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ph342
Copy link

@ph342 ph342 commented Aug 1, 2024

Currently, adding state: true to the plugin options does not work and produces an error, even though the underlying passport strategy supports it.

This change makes it work.

@ph342 ph342 force-pushed the feature/support-state branch from 291ba05 to 46deb55 Compare August 1, 2024 13:00
@thgh
Copy link
Owner

thgh commented Aug 4, 2024

Could you add a test for this?
Around this line:

client_id: 'client_id',

@ph342
Copy link
Author

ph342 commented Aug 9, 2024

Not that trivial unfortunately. To test the authorize callback, the first call should go to the payload authorize API (not the oauth provider API) which then redirects to the OAuth provider and which should have the state parameter. For that to work, the callbackURL needs to be passed as a config option or the redirect_uri is not generated. And for that, the port needs to be known to the app -- not sure how to get that information when instantiating the payload server.

@thgh
Copy link
Owner

thgh commented Aug 10, 2024

Those should be in order already:

Payload url is this:

expect(app.url).toMatch(/http:\/\/localhost:\d+/)

oAuth authorize url is here:

AUTHORIZATION_URL: oauth.url + '/authorize',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants