File tree 5 files changed +40
-3
lines changed
5 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ # 7.12.1
4
+
5
+ ### Fixes
6
+
7
+ - [ #1585 ] ( https://github.com/okta/okta-auth-js/pull/1585 ) fix: ` idx.poll ` now respects ` exchangeCodeForTokens ` and ` withCredentials ` options
8
+
3
9
# 7.12.0
4
10
5
11
### Features
Original file line number Diff line number Diff line change @@ -21,8 +21,11 @@ import { getSavedTransactionMeta } from './transactionMeta';
21
21
import { warn } from '../util' ;
22
22
23
23
export async function poll ( authClient : OktaAuthIdxInterface , options : IdxPollOptions = { } ) : Promise < IdxTransaction > {
24
+ const { withCredentials, exchangeCodeForTokens } = options ;
24
25
let transaction = await proceed ( authClient , {
25
- startPolling : true
26
+ startPolling : true ,
27
+ withCredentials,
28
+ exchangeCodeForTokens
26
29
} ) ;
27
30
28
31
const meta = getSavedTransactionMeta ( authClient ) ;
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import {
36
36
ActivationData ,
37
37
} from './idx-js' ;
38
38
import {
39
+ IdxOptions ,
39
40
AccountUnlockOptions ,
40
41
AuthenticationOptions ,
41
42
CancelOptions ,
@@ -91,7 +92,7 @@ export type Input = {
91
92
}
92
93
93
94
94
- export interface IdxPollOptions {
95
+ export interface IdxPollOptions extends Pick < IdxOptions , 'exchangeCodeForTokens' | 'withCredentials' > {
95
96
required ?: boolean ;
96
97
refresh ?: number ;
97
98
}
Original file line number Diff line number Diff line change 2
2
"private" : true ,
3
3
"name" : " @okta/okta-auth-js" ,
4
4
"description" : " The Okta Auth SDK" ,
5
- "version" : " 7.12.0 " ,
5
+ "version" : " 7.12.1 " ,
6
6
"homepage" : " https://github.com/okta/okta-auth-js" ,
7
7
"license" : " Apache-2.0" ,
8
8
"main" : " build/cjs/exports/default.js" ,
Original file line number Diff line number Diff line change @@ -159,6 +159,33 @@ describe('idx/poll', () => {
159
159
expect ( mocked . proceed . proceed ) . toHaveBeenCalledTimes ( 1 ) ;
160
160
} ) ;
161
161
162
+ it ( 'passes RunOptions through to `procced`' , async ( ) => {
163
+ const {
164
+ authClient,
165
+ enrollPollResponse
166
+ } = testContext ;
167
+
168
+ chainResponses ( [
169
+ enrollPollResponse ,
170
+ enrollPollResponse ,
171
+ ] ) ;
172
+
173
+ jest . spyOn ( mocked . introspect , 'introspect' )
174
+ . mockResolvedValue ( enrollPollResponse ) ;
175
+ const proccedSpy = jest . spyOn ( mocked . proceed , 'proceed' ) ;
176
+
177
+ await poll ( authClient , {
178
+ exchangeCodeForTokens : false ,
179
+ withCredentials : false
180
+ } ) ;
181
+ expect ( proccedSpy ) . toHaveBeenCalledTimes ( 1 ) ;
182
+ expect ( proccedSpy ) . toHaveBeenLastCalledWith ( authClient , expect . objectContaining ( {
183
+ startPolling : true ,
184
+ exchangeCodeForTokens : false ,
185
+ withCredentials : false
186
+ } ) ) ;
187
+ } ) ;
188
+
162
189
it ( 'polls until completion when refresh parameter is passed' , async ( ) => {
163
190
const {
164
191
authClient,
You can’t perform that action at this time.
0 commit comments