Skip to content

Instantly share code, notes, and snippets.

@alyssaq
Created October 24, 2014 18:25
Show Gist options
  • Save alyssaq/1a836d4e5dcf8efd1d9b to your computer and use it in GitHub Desktop.
Save alyssaq/1a836d4e5dcf8efd1d9b to your computer and use it in GitHub Desktop.
auth0-widget
$(document).ready(function() {
var widget = new Auth0Widget({
domain: 'xxx.auth0.com',
clientID: 'CLIENTID',
callbackURL: window.location.href,
callbackOnLocationHash: true
});
var result = widget.parseHash(location.hash);
if (result && result.id_token) {
widget.getProfile(result.id_token, function (err, profile) {
window.location.hash = '';
if (err) {
console.error('Error fetching profile: ' + JSON.stringify(err));
}
localStorage.setItem('auth0Profile', JSON.stringify(profile));
});
}
widget.signin({
chrome: true,
container: 'login',
connections: ['google-oauth2'],
connection_scopes: {
'google-oauth2':['https://www.googleapis.com/auth/plus.profile.emails.read']
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment