Created
October 24, 2014 18:25
-
-
Save alyssaq/1a836d4e5dcf8efd1d9b to your computer and use it in GitHub Desktop.
auth0-widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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