File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { buildUrl } from 'build-url-ts' ;
2
+ import { apiLogger } from '../logger' ;
2
3
3
4
type Secrets = {
4
5
tenantId : string ;
@@ -37,6 +38,8 @@ export class MsAuthClient {
37
38
this . statesTail = ( this . statesTail + 1 ) % this . maxStates ;
38
39
this . states [ this . statesTail ] = _state ;
39
40
41
+ console . log ( `New state added: ${ _state } \nCurrent tail: ${ this . statesTail } \nStates: ${ this . states } ` ) ;
42
+
40
43
const url = buildUrl ( this . msAuthEndpoint , {
41
44
path : '/authorize' ,
42
45
queryParams : {
@@ -55,10 +58,12 @@ export class MsAuthClient {
55
58
56
59
public async verifyAndConsumeCode ( code : string , state : string ) {
57
60
const index = this . states . indexOf ( state ) ;
61
+ console . log ( `State ${ state } at index ${ index } \nState array: ${ this . states } \nstates[index] = ${ this . states [ index ] } ` )
58
62
if ( index == - 1 ) {
59
63
throw new Error ( `Failed to verify code: Mismatched state.` ) ;
60
64
}
61
65
this . states [ index ] = undefined ;
66
+ console . log ( `Removed state ${ state } at index ${ index } \nState array: ${ this . states } \nstates[index] = ${ this . states [ index ] } ` )
62
67
63
68
const req = await fetch ( `${ this . msAuthEndpoint } /token` , {
64
69
method : 'POST' ,
You can’t perform that action at this time.
0 commit comments