Skip to content

Instantly share code, notes, and snippets.

View adamjmcgrath's full-sized avatar

Adam Mcgrath adamjmcgrath

  • Auth0
  • London, UK
View GitHub Profile
(() => {
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();
@adamjmcgrath
adamjmcgrath / .gitignore
Last active May 5, 2020 16:52
auth0-spa-js build test
dist
@adamjmcgrath
adamjmcgrath / README.md
Created May 2, 2020 07:03
rollup plugin warning

run npm start

$ rollup -c && webpack rolled-up.js

> [email protected] start /dev/tmp-rollup-webpack
> rollup -c && webpack rolled-up.js


index.js → rolled-up.js...
@adamjmcgrath
adamjmcgrath / README.md
Last active April 24, 2020 15:11
rollup plugin bug

run npm start

...
ReferenceError: Blob is not defined
...
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
foo: {
bar: 0
},
init() {
@adamjmcgrath
adamjmcgrath / controllers.application.js
Last active August 12, 2017 00:19
Ember partial memory leak
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
show: true,
version: Ember.VERSION,
actions: {
toggle() {
this.toggleProperty('show');
this.set('glimmerEnvStrings', Ember.getOwner(this).lookup('service:-glimmer-environment').constants.strings.length);
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@adamjmcgrath
adamjmcgrath / signature.js
Last active November 12, 2016 09:12
OAuth 1.0a signature generator using Ramda
const R = require('ramda')
const hmacsha1 = require('hmacsha1');
// Map arguments to OAuth keys.
const OAUTH_KEYS = {
consumerKey: 'oauth_consumer_key',
signatureMethod: 'oauth_signature_method',
oauthToken: 'oauth_token',
version: 'oauth_version',
nonce: 'oauth_nonce',