@@ -121,8 +121,8 @@ export async function authorize(
121121 hint ?: string ;
122122 usid ?: string ;
123123 } & { [ key in `c_${string } `] : any } ,
124- headers ?: { [ key : string ] : string } ,
125- privateClient = false
124+ privateClient = false ,
125+ headers ?: { [ key : string ] : string }
126126) : Promise < { code : string ; url : string ; usid : string } > {
127127 interface ClientOptions {
128128 codeChallenge ?: string ;
@@ -359,8 +359,6 @@ export async function loginGuestUserPrivate(
359359 channel_id : slasClient . clientConfig . parameters . siteId ,
360360 ...( parameters . usid && { usid : parameters . usid } ) ,
361361 ...( parameters . dnt !== undefined && { dnt : parameters . dnt . toString ( ) } ) ,
362- // no need to validate here since `slasClient.getAccessToken` will do that
363- ...restOfParams ,
364362 } ,
365363 } ;
366364
@@ -389,21 +387,24 @@ export async function loginGuestUser(
389387 usid ?: string ;
390388 dnt ?: boolean ;
391389 } & { [ key in `c_${string } `] : any } ,
392- headers ?: { [ key : string ] : string }
390+ headers ?: { [ key : string ] : string } ,
391+ body ?: { [ key : string ] : string }
393392) : Promise < TokenResponse > {
394393 const codeVerifier = createCodeVerifier ( ) ;
395394
395+ const { dnt, redirectURI, ...restOfParams } = parameters ;
396396 const authResponse = await authorize (
397397 slasClient ,
398398 codeVerifier ,
399399 {
400400 redirectURI : parameters . redirectURI ,
401401 hint : 'guest' ,
402402 ...( parameters . usid && { usid : parameters . usid } ) ,
403+ ...restOfParams ,
403404 } ,
405+ false ,
404406 headers
405407 ) ;
406- const { dnt, redirectURI, ...restOfParams } = parameters ;
407408 const tokenBody : TokenRequest = {
408409 client_id : slasClient . clientConfig . parameters . clientId ,
409410 channel_id : slasClient . clientConfig . parameters . siteId ,
@@ -413,7 +414,7 @@ export async function loginGuestUser(
413414 redirect_uri : redirectURI ,
414415 usid : authResponse . usid ,
415416 ...( dnt !== undefined && { dnt : dnt . toString ( ) } ) ,
416- ...restOfParams ,
417+ ...body ,
417418 } ;
418419
419420 return slasClient . getAccessToken ( { body : tokenBody , headers} ) ;
0 commit comments