Skip to content

Instantly share code, notes, and snippets.

View adamjmcgrath's full-sized avatar

Adam Mcgrath adamjmcgrath

  • Auth0
  • London, UK
View GitHub Profile
@adamjmcgrath
adamjmcgrath / .gitignore
Last active May 5, 2020 16:52
auth0-spa-js build test
dist
(() => {
const DOMAIN_URL = 'https://brucke.auth0.com';
const CLIENT_ID = 'wLSIP47wM39wKdDmOj6Zb5eSEw3JVhVp';
const iframe = window.document.createElement('iframe');
iframe.setAttribute('width', '0');
iframe.setAttribute('height', '0');
iframe.style.display = 'none';
window.addEventListener(
'message',

auth0-react static getAccessToken method

There are many use cases to use getAccessTokenSilently outside of a component (for example, in an Axios Interceptor or an Apollo Client).

It's tempting to ask for the option to pass an Auth0Client instance into the Auth0Provider so that its getTokenSilently method can used outside of the context of a component, eg.

const client = new Auth0Client();
export const getAccessToken = () => client.getTokenSilently();