@@ -1649,15 +1649,17 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1649
1649
return Promise . reject ( err ) ;
1650
1650
}
1651
1651
1652
- if ( ! nonceInState ) {
1653
- return Promise . resolve ( ) ;
1654
- }
1652
+ if ( ! options . disableNonceCheck ) {
1653
+ if ( ! nonceInState ) {
1654
+ return Promise . resolve ( ) ;
1655
+ }
1655
1656
1656
- const success = this . validateNonce ( nonceInState ) ;
1657
- if ( ! success ) {
1658
- const event = new OAuthErrorEvent ( 'invalid_nonce_in_state' , null ) ;
1659
- this . eventsSubject . next ( event ) ;
1660
- return Promise . reject ( event ) ;
1657
+ const success = this . validateNonce ( nonceInState ) ;
1658
+ if ( ! success ) {
1659
+ const event = new OAuthErrorEvent ( 'invalid_nonce_in_state' , null ) ;
1660
+ this . eventsSubject . next ( event ) ;
1661
+ return Promise . reject ( event ) ;
1662
+ }
1661
1663
}
1662
1664
1663
1665
this . storeSessionState ( sessionState ) ;
@@ -1717,10 +1719,15 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1717
1719
}
1718
1720
}
1719
1721
1720
- return this . fetchAndProcessToken ( params ) ;
1722
+ return this . fetchAndProcessToken ( params , options ) ;
1721
1723
}
1722
1724
1723
- private fetchAndProcessToken ( params : HttpParams ) : Promise < TokenResponse > {
1725
+ private fetchAndProcessToken (
1726
+ params : HttpParams ,
1727
+ options : LoginOptions
1728
+ ) : Promise < TokenResponse > {
1729
+ options = options || { } ;
1730
+
1724
1731
this . assertUrlNotNullAndCorrectProtocol (
1725
1732
this . tokenEndpoint ,
1726
1733
'tokenEndpoint'
@@ -1767,7 +1774,8 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1767
1774
if ( this . oidc && tokenResponse . id_token ) {
1768
1775
this . processIdToken (
1769
1776
tokenResponse . id_token ,
1770
- tokenResponse . access_token
1777
+ tokenResponse . access_token ,
1778
+ options . disableNonceCheck
1771
1779
)
1772
1780
. then ( result => {
1773
1781
this . storeIdToken ( result ) ;
@@ -1871,7 +1879,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1871
1879
) ;
1872
1880
}
1873
1881
1874
- if ( this . requestAccessToken && ! options . disableOAuth2StateCheck ) {
1882
+ if ( this . requestAccessToken && ! options . disableNonceCheck ) {
1875
1883
const success = this . validateNonce ( nonceInState ) ;
1876
1884
1877
1885
if ( ! success ) {
@@ -1900,7 +1908,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1900
1908
return Promise . resolve ( true ) ;
1901
1909
}
1902
1910
1903
- return this . processIdToken ( idToken , accessToken )
1911
+ return this . processIdToken ( idToken , accessToken , options . disableNonceCheck )
1904
1912
. then ( result => {
1905
1913
if ( options . validationHandler ) {
1906
1914
return options
0 commit comments