Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8715659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:54:02+00:00 2026-06-13T05:54:02+00:00

When the user revokes the app permission through facebook, this code should ask the

  • 0

When the user revokes the app permission through facebook, this code should ask the user to re-authorize, however it isn’t. Can anyone see something wrong? “facebook” is a Facebook object.

public void facebookSetup() {
    mPrefs = getPreferences(MODE_PRIVATE);
    String access_token = mPrefs.getString("access_token", null);   //load an access token from sharedPreferences
    long expires = mPrefs.getLong("access_expires", 0);     //do the same for the token expiration time

    if (access_token != null) { //if the access token exists in sharedPreferences, we'll use it
        facebook.setAccessToken(access_token);
    }
    if (expires != 0) { //if the expiration time exists in shared preferences, use it
        facebook.setAccessExpires(expires);
    }

    if (!facebook.isSessionValid()) {
        facebook.authorize(this, new String[] { "email", "publish_stream", "user_photos", "publish_actions"}, new DialogListener() {
            @Override
            public void onComplete(Bundle values) {
                SharedPreferences.Editor editor = mPrefs.edit();
                editor.putString("access_token", facebook.getAccessToken());
                editor.putLong("access_expires", facebook.getAccessExpires());
                editor.commit();
            }
            @Override
            public void onFacebookError(FacebookError error) {}

            @Override
            public void onError(DialogError e) {}

            @Override
            public void onCancel() {}
        });
    } 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:54:04+00:00Added an answer on June 13, 2026 at 5:54 am

    This is what Facebook SDK docs say:

    You may detect access token errors by inspecting the response
    parameter of the onComplete method. In this case, you will again need
    to call facebook.authorize() to re-authenticate the user and generate
    a fresh access token.

    You need to check response of your Facebook calls to detect such sitautuons. E.g.:

    JSONObject responseJSON = new JSONObject(response);
    JSONObject errorJSON = responseJSON.optJSONObject("error");
    if (errorJSON!=null) {
        String error =errorJSON.optString("type");           
        if (error!=null && error.equals("OAuthException")) {    
            facebook.authorize(activity, FACEBOOK_PERMISSIONS, facebookDialogListener); 
            return; 
        }       
    }       
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

User Story: Action for Facebook that has open graph object. For this I need
I've integrated the SLRequest class with my app and can successfully update user timelines
User inserts a string in a html form input on browser. This string is
User has many Tracks, through Favorite. Favorite has some extra per-user meta-data about the
User Defined Function (UDFs) are functions that one can program and can be dynamically
As you can see in the current code below, I am finding the duplicate
User Entry like this textbox1.text = 01/02/03/...... I want to display the values separately
Say, an app declared itself as <uses-permission android:name=android.permission.INTERNET /> Is there a way for
The fb android sdk doc makes this reference: However, note that this doesn't account
Hopefully someone can help me out on this one. Consider the following use-cases: Add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.