Skip to content

Instantly share code, notes, and snippets.

@mgonto
Created October 1, 2014 15:13
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/436501d13bc577b02907 to your computer and use it in GitHub Desktop.
Save mgonto/436501d13bc577b02907 to your computer and use it in GitHub Desktop.
Angular
var request = new Request();
request.url = bla;
// Header sent automatically
request.make();
authProvider.init({
clientId,
clientSecret,
domain,
offline_mode: true
});
auth.signin({}, function success(profile, id_token, ) {
// Tokens are magically saved for you in localStorage
}, function error(err) {
})
auth.refreshToken(function(newIdToken) {
// Use the new one
auth.idToken = newIdToken;
});
// Automatically refreshed for you if expired and you try to do an operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment