@@ -911,7 +911,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
911
911
) ;
912
912
913
913
return new Promise ( ( resolve , reject ) => {
914
- let params = new HttpParams ( )
914
+ let params = new HttpParams ( { encoder : new WebHttpUrlEncodingCodec ( ) } )
915
915
. set ( 'grant_type' , 'refresh_token' )
916
916
. set ( 'scope' , this . scope )
917
917
. set ( 'refresh_token' , this . _storage . getItem ( 'refresh_token' ) ) ;
@@ -1644,7 +1644,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1644
1644
if ( grantedScopes && ! Array . isArray ( grantedScopes ) ) {
1645
1645
this . _storage . setItem (
1646
1646
'granted_scopes' ,
1647
- JSON . stringify ( grantedScopes . split ( '+ ' ) )
1647
+ JSON . stringify ( grantedScopes . split ( ' ' ) )
1648
1648
) ;
1649
1649
} else if ( grantedScopes && Array . isArray ( grantedScopes ) ) {
1650
1650
this . _storage . setItem ( 'granted_scopes' , JSON . stringify ( grantedScopes ) ) ;
@@ -1717,7 +1717,11 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1717
1717
. replace ( / s e s s i o n _ s t a t e = [ ^ & \$ ] * / , '' )
1718
1718
. replace ( / ^ \? & / , '?' )
1719
1719
. replace ( / & $ / , '' )
1720
- . replace ( / ^ \? $ / , '' ) + location . hash ;
1720
+ . replace ( / ^ \? $ / , '' )
1721
+ . replace ( / & + / g, '&' )
1722
+ . replace ( / \? & / , '?' )
1723
+ . replace ( / \? $ / , '' )
1724
+ + location . hash ;
1721
1725
1722
1726
history . replaceState ( null , window . name , href ) ;
1723
1727
}
@@ -1781,7 +1785,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1781
1785
code : string ,
1782
1786
options : LoginOptions
1783
1787
) : Promise < object > {
1784
- let params = new HttpParams ( )
1788
+ let params = new HttpParams ( { encoder : new WebHttpUrlEncodingCodec ( ) } )
1785
1789
. set ( 'grant_type' , 'authorization_code' )
1786
1790
. set ( 'code' , code )
1787
1791
. set ( 'redirect_uri' , options . customRedirectUri || this . redirectUri ) ;
@@ -2352,7 +2356,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
2352
2356
if ( this . getAccessToken ( ) ) {
2353
2357
const expiresAt = this . _storage . getItem ( 'expires_at' ) ;
2354
2358
const now = this . dateTimeService . new ( ) ;
2355
- if ( expiresAt && parseInt ( expiresAt , 10 ) < now . getTime ( ) ) {
2359
+ if ( expiresAt && parseInt ( expiresAt , 10 ) < now . getTime ( ) + this . clockSkewInSec ) {
2356
2360
return false ;
2357
2361
}
2358
2362
@@ -2369,7 +2373,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
2369
2373
if ( this . getIdToken ( ) ) {
2370
2374
const expiresAt = this . _storage . getItem ( 'id_token_expires_at' ) ;
2371
2375
const now = this . dateTimeService . new ( ) ;
2372
- if ( expiresAt && parseInt ( expiresAt , 10 ) < now . getTime ( ) ) {
2376
+ if ( expiresAt && parseInt ( expiresAt , 10 ) < now . getTime ( ) + this . clockSkewInSec ) {
2373
2377
return false ;
2374
2378
}
2375
2379
@@ -2471,7 +2475,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
2471
2475
. replace ( / \{ \{ i d _ t o k e n \} \} / , encodeURIComponent ( id_token ) )
2472
2476
. replace ( / \{ \{ c l i e n t _ i d \} \} / , encodeURIComponent ( this . clientId ) ) ;
2473
2477
} else {
2474
- let params = new HttpParams ( ) ;
2478
+ let params = new HttpParams ( { encoder : new WebHttpUrlEncodingCodec ( ) } ) ;
2475
2479
2476
2480
if ( id_token ) {
2477
2481
params = params . set ( 'id_token_hint' , id_token ) ;
@@ -2709,7 +2713,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
2709
2713
return ;
2710
2714
}
2711
2715
2712
- let params = new HttpParams ( ) ;
2716
+ let params = new HttpParams ( { encoder : new WebHttpUrlEncodingCodec ( ) } ) ;
2713
2717
2714
2718
let headers = new HttpHeaders ( ) . set (
2715
2719
'Content-Type' ,
0 commit comments