@@ -1268,6 +1268,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1268
1268
}
1269
1269
1270
1270
return url ;
1271
+
1271
1272
}
1272
1273
1273
1274
initImplicitFlowInternal (
@@ -1506,32 +1507,32 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1506
1507
( tokenResponse ) => {
1507
1508
this . debug ( 'refresh tokenResponse' , tokenResponse ) ;
1508
1509
this . storeAccessTokenResponse (
1509
- tokenResponse . access_token ,
1510
- tokenResponse . refresh_token ,
1510
+ tokenResponse . access_token ,
1511
+ tokenResponse . refresh_token ,
1511
1512
tokenResponse . expires_in ,
1512
1513
tokenResponse . scope ) ;
1513
1514
1514
1515
if ( this . oidc && tokenResponse . id_token ) {
1515
- this . processIdToken ( tokenResponse . id_token , tokenResponse . access_token ) .
1516
+ this . processIdToken ( tokenResponse . id_token , tokenResponse . access_token ) .
1516
1517
then ( result => {
1517
1518
this . storeIdToken ( result ) ;
1518
-
1519
+
1519
1520
this . eventsSubject . next ( new OAuthSuccessEvent ( 'token_received' ) ) ;
1520
1521
this . eventsSubject . next ( new OAuthSuccessEvent ( 'token_refreshed' ) ) ;
1521
-
1522
+
1522
1523
resolve ( tokenResponse ) ;
1523
1524
} )
1524
1525
. catch ( reason => {
1525
1526
this . eventsSubject . next ( new OAuthErrorEvent ( 'token_validation_error' , reason ) ) ;
1526
1527
console . error ( 'Error validating tokens' ) ;
1527
1528
console . error ( reason ) ;
1528
-
1529
+
1529
1530
reject ( reason ) ;
1530
1531
} ) ;
1531
1532
} else {
1532
1533
this . eventsSubject . next ( new OAuthSuccessEvent ( 'token_received' ) ) ;
1533
1534
this . eventsSubject . next ( new OAuthSuccessEvent ( 'token_refreshed' ) ) ;
1534
-
1535
+
1535
1536
resolve ( tokenResponse ) ;
1536
1537
}
1537
1538
} ,
@@ -1654,7 +1655,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1654
1655
. then ( result => {
1655
1656
this . storeIdToken ( result ) ;
1656
1657
this . storeSessionState ( sessionState ) ;
1657
- if ( this . clearHashAfterLogin ) {
1658
+ if ( this . clearHashAfterLogin && ! options . preventClearHashAfterLogin ) {
1658
1659
location . hash = '' ;
1659
1660
}
1660
1661
this . eventsSubject . next ( new OAuthSuccessEvent ( 'token_received' ) ) ;
@@ -1691,7 +1692,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1691
1692
) : boolean {
1692
1693
const savedNonce = this . _storage . getItem ( 'nonce' ) ;
1693
1694
if ( savedNonce !== nonceInState ) {
1694
-
1695
+
1695
1696
const err = 'Validating access_token failed, wrong state/nonce.' ;
1696
1697
console . error ( err , savedNonce , nonceInState ) ;
1697
1698
return false ;
@@ -1718,7 +1719,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1718
1719
if ( options . onLoginError ) {
1719
1720
options . onLoginError ( parts ) ;
1720
1721
}
1721
- if ( this . clearHashAfterLogin ) {
1722
+ if ( this . clearHashAfterLogin && ! options . preventClearHashAfterLogin ) {
1722
1723
location . hash = '' ;
1723
1724
}
1724
1725
}
0 commit comments