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

Authorization params update the incoming parameters. #57

Open
Bunpasi opened this issue Nov 29, 2024 · 0 comments
Open

Authorization params update the incoming parameters. #57

Bunpasi opened this issue Nov 29, 2024 · 0 comments

Comments

@Bunpasi
Copy link

Bunpasi commented Nov 29, 2024

Currently Strategy.authorizationParams sets the outgoing params to the incoming options. In passport-oauth2\lib\strategy.js on line 276 in the function stored we find if (state) { params.state = state; }. Because options and params are now the same object, the global state is now set to the state of a single user. This breaks the code for the next OAuth request when it reaches line 256 if (state && typeof state == 'string') {. I've rewritten the function. Hopefully you can use this.

Strategy.prototype.authorizationParams = function (options: AppleAuthorizationParams)
{
    return {
        state: options.state ?? randomBytes(5).toString('hex'),
        response_type: options.response_type ?? "code id_token",
        scope: options.scope ?? "name email",
        response_mode: options.response_mode ?? "form_post",
    };
}
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

No branches or pull requests

1 participant