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",
};
}
Currently
Strategy.authorizationParamssets the outgoing params to the incoming options. Inpassport-oauth2\lib\strategy.json line 276 in the functionstoredwe findif (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 256if (state && typeof state == 'string') {. I've rewritten the function. Hopefully you can use this.