Skip to content

Instantly share code, notes, and snippets.

@mdobson
Created December 6, 2013 15:51
Show Gist options
  • Save mdobson/7826965 to your computer and use it in GitHub Desktop.
Save mdobson/7826965 to your computer and use it in GitHub Desktop.
getLoggedInUser docs
var apigee = new Apigee.Client({
orgName:"mdobson",
appName:"sandbox"
});
//getLoggedInUser
//An async function to get the currently authenticated user via token we store in localstorage
apigee.getLoggedInUser(function(err, data, user){
//err is error flag
//Data is raw return from api
//User is Apigee.Entity or Usergrid.Entity object representing the authenticated user
if(err) {
//Here is where we can interact with the user object.
console.log(data);
} else {
var username = user.get('username');
alert(username+" is lgged in!");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment