Merge pull request #21992 from adrianchia/master

Add checkSession method to acquire new token from Auth0
This commit is contained in:
Mine Starks
2017-12-11 10:59:23 -08:00
committed by GitHub
2 changed files with 32 additions and 0 deletions
+17
View File
@@ -174,6 +174,23 @@ webAuth.login({username: 'bar', password: 'foo'}, (err, data) => {});
webAuth.crossOriginAuthenticationCallback();
webAuth.checkSession({
audience: 'https://mystore.com/api/v2',
scope: 'read:order write:order',
redirectUri: 'https://example.com/auth/silent-callback'
}, (err, authResult) => {
// Authentication tokens or error
});
webAuth.checkSession({
audience: 'https://mystore.com/api/v2',
scope: 'read:order write:order',
redirectUri: 'https://example.com/auth/silent-callback',
usePostMessage: true
}, (err, authResult) => {
// Renewed tokens or error
});
const authentication = new auth0.Authentication({
domain: 'me.auth0.com',
clientID: '...',
+15
View File
@@ -268,6 +268,14 @@ export class WebAuth {
* @param options:
*/
passwordlessVerify(options: PasswordlessVerifyOptions, callback: Auth0Callback<any>): void;
/**
* Renews an existing session on Auth0's servers using `response_mode=web_message` (i.e. Auth0's hosted login page)
*
* @param options options used in {@link authorize} call
* @param callback: any(err, token_payload)
*/
checkSession(options: CheckSessionOptions, callback: Auth0Callback<any>): void;
}
export class Redirect {
@@ -753,3 +761,10 @@ export interface AuthorizeOptions {
scope?: string;
audience?: string;
}
export interface CheckSessionOptions extends AuthorizeOptions {
/**
* optional parameter for auth0 to use postMessage to communicate between the silent callback and the SPA.
*/
usePostMessage?: boolean;
}