@@ -59,11 +59,13 @@ export class MicrosoftEntraId {
5959 body . set ( "client_id" , this . clientId ) ;
6060 }
6161 const request = createOAuth2Request ( this . tokenEndpoint , body ) ;
62- // Origin header required for public clients. Value can be anything.
63- request . headers . set ( "Origin" , "arctic" ) ;
6462 if ( this . clientSecret !== null ) {
6563 const encodedCredentials = encodeBasicCredentials ( this . clientId , this . clientId ) ;
6664 request . headers . set ( "Authorization" , `Basic ${ encodedCredentials } ` ) ;
65+ } else {
66+ // Origin header required for public clients. Must not be defined for confidential clients.
67+ // Value can be anything.
68+ request . headers . set ( "Origin" , "arctic" ) ;
6769 }
6870 const tokens = await sendTokenRequest ( request ) ;
6971 return tokens ;
@@ -80,11 +82,13 @@ export class MicrosoftEntraId {
8082 body . set ( "scope" , scopes . join ( " " ) ) ;
8183 }
8284 const request = createOAuth2Request ( this . tokenEndpoint , body ) ;
83- // Origin header required for public clients. Value can be anything.
84- request . headers . set ( "Origin" , "arctic" ) ;
8585 if ( this . clientSecret !== null ) {
8686 const encodedCredentials = encodeBasicCredentials ( this . clientId , this . clientSecret ) ;
8787 request . headers . set ( "Authorization" , `Basic ${ encodedCredentials } ` ) ;
88+ } else {
89+ // Origin header required for public clients. Must not be defined for confidential clients.
90+ // Value can be anything.
91+ request . headers . set ( "Origin" , "arctic" ) ;
8892 }
8993 const tokens = await sendTokenRequest ( request ) ;
9094 return tokens ;
0 commit comments