File tree 1 file changed +18
-17
lines changed
1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -1380,24 +1380,8 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1380
1380
}
1381
1381
}
1382
1382
1383
-
1384
- private parseQueryString ( queryString : string ) : object {
1385
- if ( ! queryString || queryString . length === 0 ) {
1386
- return { } ;
1387
- }
1388
-
1389
- if ( queryString . charAt ( 0 ) === '?' ) {
1390
- queryString = queryString . substr ( 1 ) ;
1391
- }
1392
-
1393
- return this . urlHelper . parseQueryString ( queryString ) ;
1394
-
1395
-
1396
- }
1397
-
1398
1383
public tryLoginCodeFlow ( ) : Promise < void > {
1399
-
1400
- const parts = this . parseQueryString ( window . location . search )
1384
+ const parts = this . getCodePartsFromUrl ( window . location . search ) ;
1401
1385
1402
1386
const code = parts [ 'code' ] ;
1403
1387
const state = parts [ 'state' ] ;
@@ -1445,6 +1429,23 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1445
1429
}
1446
1430
}
1447
1431
1432
+ /**
1433
+ * Retrieve the returned auth code from the redirect uri that has been called.
1434
+ * If required also check hash, as we could use hash location strategy.
1435
+ */
1436
+ private getCodePartsFromUrl ( queryString : string ) : object {
1437
+ if ( ! queryString || queryString . length === 0 ) {
1438
+ return this . urlHelper . getHashFragmentParams ( ) ;
1439
+ }
1440
+
1441
+ // normalize query string
1442
+ if ( queryString . charAt ( 0 ) === '?' ) {
1443
+ queryString = queryString . substr ( 1 ) ;
1444
+ }
1445
+
1446
+ return this . urlHelper . parseQueryString ( queryString ) ;
1447
+ }
1448
+
1448
1449
/**
1449
1450
* Get token using an intermediate code. Works for the Authorization Code flow.
1450
1451
*/
You can’t perform that action at this time.
0 commit comments