Closed l3th2nh closed 8 years ago
@l3th2nh -
when you call the login function for the first time, the result
object passed to the onSuccess
callback contains a accessToken
property.
if you want to store this, you can simply store it in localStorage in javascript if you like.
CordovaFacebook.login({
permissions: ['email', 'user_likes'],
onSuccess: function(result) {
if (result.accessToken) {
localStorage.setItem('facebookAccessToken', result.accessToken);
}
/* ... */
},
onFailure: function(result) {
if(result.cancelled) {
alert("The user doesn't like my app");
} else if(result.error) {
alert("There was an error:" + result.errorLocalized);
}
}
});
// later in your app, or next time you want to use it....
var userAccessToken = localStorage.getItem('facebookAccessToken');
// now do what you need to do....
See https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage for more detail on localStorage.
hi Blake Israel . this is great plugin for cordova , thank you for your work
how to me can get access token for facebook init ?
that mean when i use login function i can get access token , but i want when app loaded the next time i can get access token without callback login function
like : CordovaFacebook.getAccesstoken() so if that readly i can use this token , else i will call to login function
Thanks