How to give permission to login to my android app if user has fb account

Hi friends, I need to get user information from facebook, I am using code

String about_me = facebook.request ("me");

but this shows an error: ---

{"error": {"message": "The active access token should be used to request information about the current user.", "type": "OAuthException", "code": 2500}}

can any body tell me how to resolve this?

0


source to share


1 answer


this error means your Facebook object does not have a valid access token. try something like this to find out what the access token means and its expiration time.

Log.d("myapp", "access token = " + facebook.getAccessToken());
Log.d("myapp", "expiration = " + facebook.getAccessExpires());
Log.d("myapp", "expiration datetime = " + (new Date(facebook.getAccessExpires())).toString());
Log.d("myapp", "is session valid? " + facebook.isSessionValid());

      

it is your job to check if you (user) have an access token and if it is still valid. if not, you must open a dialog to proceed with authentication.



facebook.authorize(Activity activity, String[] permissions, DialogListener);

      

the new Android API for Android should work with single signal (SSO). meaning, if the user has already installed the official facebook app "THE" and registered with this official app on the device, then the user does not need to re-authenticate.

Otherwise a (ugly) dialog pops up where the user has to enter their credentials (it's just a web browser embedded in the dialog).

0


source







All Articles