@@ -38,6 +38,8 @@ export default function Root({
3838 const scope = searchParams . get ( 'scope' )
3939 ? searchParams . get ( 'scope' ) ?. toString ( ) . split ( ' ' )
4040 : [ 'openid' , 'profile' , 'email' ] ;
41+ const code = searchParams . get ( 'code' ) || '' ;
42+ const nonce = searchParams . get ( 'nonce' ) || '' ;
4143
4244 const urlProps : Record < string , any > = {
4345 state,
@@ -58,9 +60,19 @@ export default function Root({
5860 if ( token ) {
5961 let redirectURL = config . redirectURL || '/app' ;
6062 let params = `access_token=${ token . access_token } &id_token=${ token . id_token } &expires_in=${ token . expires_in } &state=${ globalState . state } ` ;
63+
64+ if ( code !== '' ) {
65+ params += `&code=${ code } ` ;
66+ }
67+
68+ if ( nonce !== '' ) {
69+ params += `&nonce=${ nonce } ` ;
70+ }
71+
6172 if ( token . refresh_token ) {
6273 params += `&refresh_token=${ token . refresh_token } ` ;
6374 }
75+
6476 const url = new URL ( redirectURL ) ;
6577 if ( redirectURL . includes ( '?' ) ) {
6678 redirectURL = `${ redirectURL } &${ params } ` ;
@@ -74,7 +86,7 @@ export default function Root({
7486 }
7587 }
7688 return ( ) => { } ;
77- } , [ token ] ) ;
89+ } , [ token , config ] ) ;
7890
7991 if ( loading ) {
8092 return < h1 > Loading...</ h1 > ;
@@ -100,7 +112,7 @@ export default function Root({
100112 < Route path = "/app" exact >
101113 < Login urlProps = { urlProps } />
102114 </ Route >
103- < Route path = "/app/signup" exact >
115+ < Route path = "/app/signup" >
104116 < SignUp urlProps = { urlProps } />
105117 </ Route >
106118 < Route path = "/app/reset-password" >
0 commit comments