fix redirect error encoding
Signed-off-by: Stephen Glass <stephen@stephen.glass>
This commit is contained in:
@@ -768,9 +768,7 @@ describe('createOAuthRouteHandlers', () => {
|
||||
|
||||
// Verify that the 'error' search param is set with the encoded error message
|
||||
const errorMessage = redirectUrl.searchParams.get('error');
|
||||
expect(errorMessage).toBe(
|
||||
encodeURIComponent('Auth response is missing cookie nonce'),
|
||||
);
|
||||
expect(errorMessage).toBe('Auth response is missing cookie nonce');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -252,7 +252,7 @@ export function createOAuthRouteHandlers<TProfile>(
|
||||
|
||||
if (state?.flow === 'redirect' && state?.redirectUrl) {
|
||||
const redirectUrl = new URL(state.redirectUrl);
|
||||
redirectUrl.searchParams.set('error', encodeURIComponent(message));
|
||||
redirectUrl.searchParams.set('error', message);
|
||||
|
||||
// set the error in a cookie and redirect user back to sign in where the error can be rendered
|
||||
res.redirect(redirectUrl.toString());
|
||||
|
||||
Reference in New Issue
Block a user