@auth0/auth0-angular 1.6.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,12 @@
1
1
  import { OnDestroy } from '@angular/core';
2
- import { Auth0Client, RedirectLoginOptions, PopupLoginOptions, PopupConfigOptions, LogoutOptions, GetTokenSilentlyOptions, GetTokenWithPopupOptions, RedirectLoginResult, LogoutUrlOptions } from '@auth0/auth0-spa-js';
2
+ import { Auth0Client, RedirectLoginOptions, PopupLoginOptions, PopupConfigOptions, LogoutOptions, GetTokenSilentlyOptions, GetTokenWithPopupOptions, RedirectLoginResult, LogoutUrlOptions, GetTokenSilentlyVerboseResponse } from '@auth0/auth0-spa-js';
3
3
  import { Observable } from 'rxjs';
4
4
  import { AbstractNavigator } from './abstract-navigator';
5
- import { Location } from '@angular/common';
6
- import { AuthClientConfig } from './auth.config';
5
+ import { AuthClientConfig, AppState } from './auth.config';
7
6
  import { AuthState } from './auth.state';
8
- export declare class AuthService implements OnDestroy {
7
+ export declare class AuthService<TAppState extends AppState = AppState> implements OnDestroy {
9
8
  private auth0Client;
10
9
  private configFactory;
11
- private location;
12
10
  private navigator;
13
11
  private authState;
14
12
  private appStateSubject$;
@@ -29,7 +27,7 @@ export declare class AuthService implements OnDestroy {
29
27
  /**
30
28
  * Emits ID token claims when authenticated, or null if not authenticated.
31
29
  */
32
- readonly idTokenClaims$: Observable<import("@auth0/auth0-spa-js").IdToken | null>;
30
+ readonly idTokenClaims$: Observable<import("@auth0/auth0-spa-js").IdToken | null | undefined>;
33
31
  /**
34
32
  * Emits errors that occur during login, or when checking for an active session on startup.
35
33
  */
@@ -38,8 +36,8 @@ export declare class AuthService implements OnDestroy {
38
36
  * Emits the value (if any) that was passed to the `loginWithRedirect` method call
39
37
  * but only **after** `handleRedirectCallback` is first called
40
38
  */
41
- readonly appState$: Observable<any>;
42
- constructor(auth0Client: Auth0Client, configFactory: AuthClientConfig, location: Location, navigator: AbstractNavigator, authState: AuthState);
39
+ readonly appState$: Observable<TAppState>;
40
+ constructor(auth0Client: Auth0Client, configFactory: AuthClientConfig, navigator: AbstractNavigator, authState: AuthState);
43
41
  /**
44
42
  * Called when the service is destroyed
45
43
  */
@@ -55,7 +53,7 @@ export declare class AuthService implements OnDestroy {
55
53
  *
56
54
  * @param options The login options
57
55
  */
58
- loginWithRedirect(options?: RedirectLoginOptions): Observable<void>;
56
+ loginWithRedirect(options?: RedirectLoginOptions<TAppState>): Observable<void>;
59
57
  /**
60
58
  * ```js
61
59
  * await loginWithPopup(options);
@@ -91,29 +89,15 @@ export declare class AuthService implements OnDestroy {
91
89
  */
92
90
  logout(options?: LogoutOptions): void;
93
91
  /**
94
- * ```js
95
- * getAccessTokenSilently(options).subscribe(token => ...)
96
- * ```
97
- *
98
- * If there's a valid token stored, return it. Otherwise, opens an
99
- * iframe with the `/authorize` URL using the parameters provided
100
- * as arguments. Random and secure `state` and `nonce` parameters
101
- * will be auto-generated. If the response is successful, results
102
- * will be valid according to their expiration times.
103
- *
104
- * If refresh tokens are used, the token endpoint is called directly with the
105
- * 'refresh_token' grant. If no refresh token is available to make this call,
106
- * the SDK falls back to using an iframe to the '/authorize' URL.
92
+ * Fetches a new access token and returns the response from the /oauth/token endpoint, omitting the refresh token.
107
93
  *
108
- * This method may use a web worker to perform the token call if the in-memory
109
- * cache is used.
110
- *
111
- * If an `audience` value is given to this function, the SDK always falls
112
- * back to using an iframe to make the token exchange.
113
- *
114
- * Note that in all cases, falling back to an iframe requires access to
115
- * the `auth0` cookie, and thus will not work in browsers that block third-party
116
- * cookies by default (Safari, Brave, etc).
94
+ * @param options The options for configuring the token fetch.
95
+ */
96
+ getAccessTokenSilently(options: GetTokenSilentlyOptions & {
97
+ detailedResponse: true;
98
+ }): Observable<GetTokenSilentlyVerboseResponse>;
99
+ /**
100
+ * Fetches a new access token and returns it.
117
101
  *
118
102
  * @param options The options for configuring the token fetch.
119
103
  */
@@ -145,7 +129,7 @@ export declare class AuthService implements OnDestroy {
145
129
  *
146
130
  * @param url The URL to that should be used to retrieve the `state` and `code` values. Defaults to `window.location.href` if not given.
147
131
  */
148
- handleRedirectCallback(url?: string): Observable<RedirectLoginResult>;
132
+ handleRedirectCallback(url?: string): Observable<RedirectLoginResult<TAppState>>;
149
133
  /**
150
134
  * ```js
151
135
  * buildAuthorizeUrl().subscribe(url => ...)
@@ -35,7 +35,7 @@ export declare class AuthState {
35
35
  /**
36
36
  * Emits ID token claims when authenticated, or null if not authenticated.
37
37
  */
38
- readonly idTokenClaims$: import("rxjs").Observable<import("@auth0/auth0-spa-js").IdToken | null>;
38
+ readonly idTokenClaims$: import("rxjs").Observable<import("@auth0/auth0-spa-js").IdToken | null | undefined>;
39
39
  /**
40
40
  * Emits errors that occur during login, or when checking for an active session on startup.
41
41
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/auth0-angular",
3
- "version": "1.6.1",
3
+ "version": "1.8.1",
4
4
  "description": "Auth0 SDK for Angular Single Page Applications (SPA)",
5
5
  "keywords": [
6
6
  "auth0",
@@ -21,8 +21,9 @@
21
21
  },
22
22
  "homepage": "https://github.com/auth0/auth0-angular#readme",
23
23
  "peerDependencies": {
24
- "@angular/common": ">=9 <=12",
25
- "@angular/core": ">=9 <=12"
24
+ "@angular/common": ">=9 <=13",
25
+ "@angular/core": ">=9 <=13",
26
+ "@angular/router": ">=9 <=13"
26
27
  },
27
28
  "dependencies": {
28
29
  "tslib": "^2.0.0",
package/public-api.d.ts CHANGED
@@ -5,4 +5,4 @@ export * from './lib/auth.interceptor';
5
5
  export * from './lib/auth.config';
6
6
  export * from './lib/auth.client';
7
7
  export * from './lib/auth.state';
8
- export { ICache, Cacheable, LocalStorageCache, InMemoryCache, } from '@auth0/auth0-spa-js';
8
+ export { ICache, Cacheable, LocalStorageCache, InMemoryCache, IdToken, User } from '@auth0/auth0-spa-js';