File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 11import { buildUrl } from 'build-url-ts' ;
2+ import { apiLogger } from '../logger' ;
23
34type Secrets = {
45 tenantId : string ;
@@ -37,6 +38,8 @@ export class MsAuthClient {
3738 this . statesTail = ( this . statesTail + 1 ) % this . maxStates ;
3839 this . states [ this . statesTail ] = _state ;
3940
41+ console . log ( `New state added: ${ _state } \nCurrent tail: ${ this . statesTail } \nStates: ${ this . states } ` ) ;
42+
4043 const url = buildUrl ( this . msAuthEndpoint , {
4144 path : '/authorize' ,
4245 queryParams : {
@@ -55,10 +58,12 @@ export class MsAuthClient {
5558
5659 public async verifyAndConsumeCode ( code : string , state : string ) {
5760 const index = this . states . indexOf ( state ) ;
61+ console . log ( `State ${ state } at index ${ index } \nState array: ${ this . states } \nstates[index] = ${ this . states [ index ] } ` )
5862 if ( index == - 1 ) {
5963 throw new Error ( `Failed to verify code: Mismatched state.` ) ;
6064 }
6165 this . states [ index ] = undefined ;
66+ console . log ( `Removed state ${ state } at index ${ index } \nState array: ${ this . states } \nstates[index] = ${ this . states [ index ] } ` )
6267
6368 const req = await fetch ( `${ this . msAuthEndpoint } /token` , {
6469 method : 'POST' ,
You can’t perform that action at this time.
0 commit comments