Skip to content

Instantly share code, notes, and snippets.

@quiaro
Created November 15, 2017 17:35
Show Gist options
  • Select an option

  • Save quiaro/b676ce06e062f1cc364bf4d6c76b3927 to your computer and use it in GitHub Desktop.

Select an option

Save quiaro/b676ce06e062f1cc364bf4d6c76b3927 to your computer and use it in GitHub Desktop.
Get ID token when authenticating via Auth0
import auth0 from 'auth0-js';
const CLIENT_DOMAIN = '__AUTH0_DOMAIN__';
const CLIENT_ID = '__AUTH0_CLIENT_ID__';
const SCOPE = 'openid email';
const REDIRECT = 'http://localhost:3000/callback';
const auth = new auth0.WebAuth({
domain: CLIENT_DOMAIN,
clientID: CLIENT_ID,
});
export function login() {
auth.authorize({
responseType: 'id_token',
redirectUri: REDIRECT,
scope: SCOPE,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment