@idea-ionic/auth0
Version:
55 lines (54 loc) • 1.85 kB
TypeScript
import { AuthService } from '@auth0/auth0-angular';
import { Auth0User } from 'idea-toolbox';
import * as i0 from "@angular/core";
export declare class IDEAAuth0Service {
protected _env: any;
private _platform;
private _auth0;
/**
* The internal Auth0's service.
*/
get __raw(): AuthService;
private isMobileDevice;
/**
* Open (if needed) Auth0's Universal Login page, to authenticate a user.
* @param afterRedirectTo where to go after a successful login
*/
goToLogin(afterRedirectTo?: string): void;
private loginWithSPA;
private loginWithMobile;
/**
* Open (if needed) Auth0's Universal Login page, to logout a user.
*/
goToLogout(): void;
private logoutWithSPA;
private logoutWithMobile;
/**
* Handle the callback after a login or logout in Auth0 Universal Login page.
* In order to work, it has to be used in `app.component.ts`, as explained in the following snippet:
* ```
export class AppComponent {
constructor(private ngZone: NgZone, private auth0: IDEAAuth0Service) {
App.addListener('appUrlOpen', ({ url }): void =>
this.ngZone.run((): void => this.auth0.handleCallbackOnMobileDevices(url))
);
}
}
* ```
*/
handleCallbackOnMobileDevices(url: string): Promise<void>;
/**
* Get the ID token, to use for authenticating API requests to the back-end.
*/
getIdToken(): Promise<string>;
/**
* Whether the user is currently authenticated.
*/
isUserAuthenticated(): Promise<boolean>;
/**
* Get the current user and its data.
*/
getUser(): Promise<Auth0User>;
static ɵfac: i0.ɵɵFactoryDeclaration<IDEAAuth0Service, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<IDEAAuth0Service>;
}