@idea-ionic/auth0
Version:
68 lines (63 loc) • 2.31 kB
TypeScript
import * as i0 from '@angular/core';
import * as i1 from '@auth0/auth0-angular';
import { AuthService } from '@auth0/auth0-angular';
import { Auth0User } from 'idea-toolbox';
import { CanActivateFn } from '@angular/router';
declare class IDEAAuth0Module {
static ɵfac: i0.ɵɵFactoryDeclaration<IDEAAuth0Module, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<IDEAAuth0Module, never, [typeof i1.AuthModule], never>;
static ɵinj: i0.ɵɵInjectorDeclaration<IDEAAuth0Module>;
}
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>;
}
declare const auth0Guard: CanActivateFn;
export { IDEAAuth0Module, IDEAAuth0Service, auth0Guard };