How get Facebook user info when we use $cordovaOauth.facebook()?

Yes, $cordovaOauth.facebook() allows to get authentication access token easly, but we only get access token and expire. So how get user id after response ?

You may want to check out this example I made:


Ok! but the genereted access token is Short-Term or Long-Term Token ?
I want my app able user to login withijn his facebook login and save information to my database.
and if user relaunch app , he can publish on facebook without relogin by facebook dialog .
is it possible with $cordova.Oauth() ??

The access token is good until it expires. Save it in local storage and keep using it. Check the expiration time and either refresh the token or re authenticate when necessary.

Check out the Facebook API to learn about refresh tokens.

Does this help?


yes but it not tell me if token is long-lived or not.
cause to extend or refresh, we must know that .

The expiration time tells you everything you need to know. When the token expires it is no longer usable so check before every API request.

Yes I can handle error returned , check the error code and try to extend expiration server-side

Hey $cordovaOauth is good. But you might want to check out : for facebook login (native facebook app and a fallback if not available) for facebook login and for google login.

If you have any doubts ping me.

i am using $cordovaOauth.facebook() plugin in ionic 1 app and android platform is 6.2.2. but i got the error something like “You are not logged in.please try again.” could you please tell me the facebook app settings on facebook developer console that how i add valid oauth redirect uri and what options should be on ? i am really stuck for in this from past many days. please help urgently. any help is appreciated.

$cordovaOauth.facebook(“166955943840019”, [“email”, “read_stream”, “user_website”, “user_location”, “user_relationships”]).then(function(result) {
// results
}, function(error) {
// error