fix: add nonce
This commit is contained in:
@@ -38,7 +38,8 @@ export default function Root({
|
||||
const scope = searchParams.get('scope')
|
||||
? searchParams.get('scope')?.toString().split(' ')
|
||||
: ['openid', 'profile', 'email'];
|
||||
const code = searchParams.get('code') || createRandomString()
|
||||
const code = searchParams.get('code') || ''
|
||||
const nonce = searchParams.get('nonce') || ''
|
||||
|
||||
const urlProps: Record<string, any> = {
|
||||
state,
|
||||
@@ -59,9 +60,17 @@ export default function Root({
|
||||
if (token) {
|
||||
let redirectURL = config.redirectURL || '/app';
|
||||
let params = `access_token=${token.access_token}&id_token=${token.id_token}&expires_in=${token.expires_in}&state=${globalState.state}&code=`+code;
|
||||
|
||||
if (code !== '') {
|
||||
params += `&code=${code}`
|
||||
}
|
||||
if (nonce !== '') {
|
||||
params += `&nonce=${nonce}`
|
||||
}
|
||||
if (token.refresh_token) {
|
||||
params += `&refresh_token=${token.refresh_token}`;
|
||||
}
|
||||
|
||||
const url = new URL(redirectURL);
|
||||
if (redirectURL.includes('?')) {
|
||||
redirectURL = `${redirectURL}&${params}`;
|
||||
|
Reference in New Issue
Block a user