diff --git a/package-lock.json b/package-lock.json index 6b916f25..f21e6fe4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@angular/core": "^20.3.31", "@angular/platform-browser": "^20.3.31", "@angular/router": "^20.3.31", - "@auth0/auth0-spa-js": "^2.24.1", + "@auth0/auth0-spa-js": "^2.26.0", "rxjs": "^6.6.7", "tslib": "^2.8.1", "zone.js": "~0.15.1" @@ -995,20 +995,18 @@ "license": "MIT" }, "node_modules/@auth0/auth0-auth-js": { - "version": "1.12.0", - "integrity": "sha512-94r29UxcFEdroO74TUqu5KYy5hSKa6mCXY8lu4hADiyES8qthlSCwaCPEW1adpM5hdheltQ7s1o9TsK8Btyjvg==", - "license": "MIT", + "version": "1.15.0", + "integrity": "sha512-obn/Qhxx3eNs2wV6/lLsIDIcEiSJvBEEy15hppB5Me1j2No2toa7KqQcXHBCyGX4mBBdVnxZJBjEX6E4WanYwg==", "dependencies": { "jose": "^6.0.8", "openid-client": "^6.8.0" } }, "node_modules/@auth0/auth0-spa-js": { - "version": "2.24.1", - "integrity": "sha512-iS18fBlWWxQ/FPtWgWzYYEImsNRumJG2cZ08xV0HsEmWtTBv+54A+fnyFx9eiNBP7cLp0emwDDjgeG+hQEbVBA==", - "license": "MIT", + "version": "2.26.0", + "integrity": "sha512-pv2Si9bJioQqTgk/doh0nIKgnpF1TEW/CvPmC1eYUgwPk/cUIwIzNSPShFBM4G2MnR+pbeD2HhFH6ChJAzIeqg==", "dependencies": { - "@auth0/auth0-auth-js": "^1.10.0", + "@auth0/auth0-auth-js": "^1.15.0", "browser-tabs-lock": "^1.3.0", "dpop": "^2.1.1", "es-cookie": "~1.3.2" @@ -13979,9 +13977,8 @@ } }, "node_modules/jose": { - "version": "6.2.8", - "integrity": "sha512-Bsdjwm3Qsd/P0jR+BHDe3LytDfY7WBq2HmCCLIwuVRHMuEC9ae7/R474GIUdF1NgCyZjzVo/A9DOiOBtXq8ZoQ==", - "license": "MIT", + "version": "6.2.12", + "integrity": "sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==", "funding": { "url": "https://github.com/sponsors/panva" } @@ -16726,9 +16723,8 @@ } }, "node_modules/oauth4webapi": { - "version": "3.8.6", - "integrity": "sha512-iwemM91xz8nryHti2yTmg5fhyEMVOkOXwHNqbvcATjyajb5oQxCQzrNOA6uElRHuMhQQTKUyFKV9y/CNyg25BQ==", - "license": "MIT", + "version": "3.8.8", + "integrity": "sha512-8N28E+a/oxfXWBgOMt+ZP/JUf/XR+IFbvkAEPP3gznXOMv9BpAAwiIj0TFNz3tGTPc0ZQ8zmWBNgN1nAys0gng==", "funding": { "url": "https://github.com/sponsors/panva" } @@ -17025,12 +17021,11 @@ } }, "node_modules/openid-client": { - "version": "6.8.4", - "integrity": "sha512-QSw0BA08piujetEwfZsHoTrDpMEha7GDZDicQqVwX4u0ChCjefvjDB++TZ8BTg76UpwhzIQgdvvfgfl3HpCSAw==", - "license": "MIT", + "version": "6.8.8", + "integrity": "sha512-ZsucJA5Ad04Uv7YN4ql+s4GXNmb9uAYQwyJTsJx7CH/MX3JZioLE2pVKi1SC+YrbSLA4Px3Gi30dMjgOZtb6pA==", "dependencies": { - "jose": "^6.2.2", - "oauth4webapi": "^3.8.5" + "jose": "^6.2.12", + "oauth4webapi": "^3.8.8" }, "funding": { "url": "https://github.com/sponsors/panva" diff --git a/package.json b/package.json index 938bb5cf..df9c5f23 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@angular/core": "^20.3.31", "@angular/platform-browser": "^20.3.31", "@angular/router": "^20.3.31", - "@auth0/auth0-spa-js": "^2.24.1", + "@auth0/auth0-spa-js": "^2.26.0", "rxjs": "^6.6.7", "tslib": "^2.8.1", "zone.js": "~0.15.1" diff --git a/projects/auth0-angular/package.json b/projects/auth0-angular/package.json index 28a768ee..226b2e19 100644 --- a/projects/auth0-angular/package.json +++ b/projects/auth0-angular/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "tslib": "^2.0.0", - "@auth0/auth0-spa-js": "^2.21.0" + "@auth0/auth0-spa-js": "^2.26.0" }, "schematics": "./schematics/collection.json" } diff --git a/projects/auth0-angular/src/lib/auth.interceptor.ts b/projects/auth0-angular/src/lib/auth.interceptor.ts index 5bcd37de..d6142eb2 100644 --- a/projects/auth0-angular/src/lib/auth.interceptor.ts +++ b/projects/auth0-angular/src/lib/auth.interceptor.ts @@ -118,16 +118,20 @@ export class AuthHttpInterceptor implements HttpInterceptor { ): Observable { return of(this.auth0Client).pipe( concatMap((client) => client.getTokenSilently(options)), - map((tokenOrResponse: string | GetTokenSilentlyVerboseResponse) => { - // spa-js returns undefined when cacheMode is 'cache-only' with no - // cached entry, or when an IPSIE session_expiry ceiling is reached. - if (!tokenOrResponse) { - throw { error: 'missing_token' }; + map( + ( + tokenOrResponse: string | GetTokenSilentlyVerboseResponse | undefined + ) => { + // spa-js returns undefined when cacheMode is 'cache-only' with no + // cached entry, or when an IPSIE session_expiry ceiling is reached. + if (!tokenOrResponse) { + throw { error: 'missing_token' }; + } + // Extract access_token from detailed response when detailedResponse: true + if (typeof tokenOrResponse === 'string') return tokenOrResponse; + return tokenOrResponse.access_token; } - // Extract access_token from detailed response when detailedResponse: true - if (typeof tokenOrResponse === 'string') return tokenOrResponse; - return tokenOrResponse.access_token; - }), + ), tap((token) => this.authState.setAccessToken(token)), catchError((error) => { this.authState.refresh(); diff --git a/projects/auth0-angular/src/lib/auth.service.ts b/projects/auth0-angular/src/lib/auth.service.ts index f930962d..d9e6c8da 100644 --- a/projects/auth0-angular/src/lib/auth.service.ts +++ b/projects/auth0-angular/src/lib/auth.service.ts @@ -252,14 +252,16 @@ export class AuthService */ getAccessTokenSilently( options: GetTokenSilentlyOptions & { detailedResponse: true } - ): Observable; + ): Observable; /** * Fetches a new access token and returns it. * * @param options The options for configuring the token fetch. */ - getAccessTokenSilently(options?: GetTokenSilentlyOptions): Observable; + getAccessTokenSilently( + options?: GetTokenSilentlyOptions + ): Observable; /** * ```js @@ -290,7 +292,7 @@ export class AuthService */ getAccessTokenSilently( options: GetTokenSilentlyOptions = {} - ): Observable { + ): Observable { return of(this.auth0Client).pipe( concatMap((client) => options.detailedResponse === true @@ -577,10 +579,7 @@ export class AuthService updateAuthenticationMethod: ( id: string, data: UpdateAuthenticationMethodRequest - ) => - from( - this.auth0Client.myAccount.updateAuthenticationMethod(id, data) - ), + ) => from(this.auth0Client.myAccount.updateAuthenticationMethod(id, data)), enrollmentChallenge: (options: EnrollmentChallengeOptions) => from(this.auth0Client.myAccount.enrollmentChallenge(options)), enrollmentVerify: (options: EnrollmentVerifyOptions) =>