Skip to content

Instantly share code, notes, and snippets.

@mgonto
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgonto/0f083a43f91e0ca024b9 to your computer and use it in GitHub Desktop.
Save mgonto/0f083a43f91e0ca024b9 to your computer and use it in GitHub Desktop.
var request = new Request();
request.url = bla
request.header = {
// If he used session
Authorization: 'Bearer ' + A0Session.store.idToken
}
request.make();
if (A0Session.isTokenExpired()) {
A0Session.refreshTokens(function(token, profile) {
A0Session.storeInfo(token, profile);
});
}
var login = new LoginController();
login.onAuthentication(function(profile, tokenObj) {
// Do something with Profile and Token
// YOu can save it using the SDK
A0Session.storeInfo(profile, tokenObj);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment