Skip to content

Commit 49ab332

Browse files
fix: do not clear storage when interaction required
OKTA-391537 <<<Jenkins Check-In of Tested SHA: 5bb7ae7 for [email protected]>>> Artifact: okta-auth-js Files changed count: 6 PR Link: "#742"
1 parent 64e1959 commit 49ab332

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ testenv
99
junit.xml
1010
yarn-error.*
1111
coverage
12+
testenv.yml

lib/oidc/parseFromUrl.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*/
1414
import { AuthSdkError } from '../errors';
15-
import { urlParamsToObject } from './util';
15+
import { isInteractionRequiredError, urlParamsToObject } from './util';
1616
import { ParseFromUrlOptions, TokenResponse, CustomUrls, TransactionMeta } from '../types';
1717
import { isString } from '../util';
1818
import { handleOAuthResponse } from './handleOAuthResponse';
@@ -79,8 +79,15 @@ export function parseFromUrl(sdk, options: string | ParseFromUrlOptions): Promis
7979
responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);
8080
}
8181
return handleOAuthResponse(sdk, oauthParams, res, urls)
82-
.finally(() => {
82+
.catch(err => {
83+
if (!isInteractionRequiredError(err)) {
84+
sdk.transactionManager.clear();
85+
}
86+
throw err;
87+
})
88+
.then(res => {
8389
sdk.transactionManager.clear();
90+
return res;
8491
});
8592
});
8693
}

0 commit comments

Comments
 (0)