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 7790059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:28:27+00:00 2026-06-01T21:28:27+00:00

I am using facebook plugin to login and logout a user, which are working

  • 0

I am using facebook plugin to login and logout a user, which are working fine. The problem is when I request for the logged in user details using the function FB.api(‘/me’), it always gives the following error:

      {"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500} 

I used the debug mode to check PluginResult(pr) and JSONObject of the response. JSONObject contains the user information, which I required, I dont get where I am doing wrong.

  Plz help......

MY CODE:

           function login() {
            FB.login(function(response) {
               if (response.session) {
                 console.log('Welcome!  Fetching your information.... ');
                 FB.api('/me', function(response) {
                   console.log('Good to see you, ' + JSON.stringify(response) + '.');
                 });
               } else {
                 console.log('User cancelled login or did not fully authorize.');
               }
             },{scope: 'email,user_likes'});
        }

       function logout() {
            FB.logout(function(response) {
                           console.log(localStorage.getItem("user_fb_log_status"));
                           localStorage.setItem("user_fb_log_status","LOGGED_OUT");

                      alert('logged out');
                      });
        }

The above code is working fine to login and logout the user. Below is the code i used to get the user details,

        function me() {
                FB.api('/me', { fields: 'id, name, picture' },  function(response) {
                   if (response.error) {
                   alert(JSON.stringify(response.error));
                   } else {
                   var data = document.getElementById('data');
                   fdata=response.data;
                   console.log("fdata: "+fdata);
                   response.data.forEach(function(item) {
                                         var d = document.createElement('div');
                                         d.innerHTML = "<img src="+item.picture+"/>"+item.name;
                                         data.appendChild(d);
                                         });
                   }
                   });

            }
  • 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-01T21:28:29+00:00Added an answer on June 1, 2026 at 9:28 pm

    FB.api method is working fine for me to get the user details and post a feed to the facebook after I change the following method in ConnectPlugin.java as following.

      public JSONObject getResponse() {
        String response = "{" + "\"status\": \""
                + (facebook.isSessionValid() ? "connected" : "unknown") + "\","
                +
                // "\"session\": {" + "\"access_token\": \""
                // + facebook.getAccessToken() + "\"," + "\"expires\": \""
                // + facebook.getAccessExpires() + "\","
                // + "\"session_key\": true," + "\"sig\": \"...\","
                // + "\"uid\": \"" + this.userId + "\"" +
    
                "\"authResponse\": {" +
    
                "\"accessToken\": \"" + facebook.getAccessToken() + "\"," +
    
                "\"expiresIn\": \"" + facebook.getAccessExpires() + "\"," +
    
                "\"session_key\": true," +
    
                "\"sig\": \"...\"," +
    
                "\"userId\": \"" + this.userId + "\"" +
    
                "}" + "}";
    
        try {
            return new JSONObject(response);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return new JSONObject();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using phonegap-plugin-facebook-connect and it is working well (I can login the user and
If the user has not logged into facebook, the comments plugin provides an option
I have a site that allows a user to login using their facebook login
I am using webtechnick facebook plugin, i have everything set and its FB login
i am using cakephp facebook plugin. when i click login. i get the following
Here I am using Facebook Login button plugin and javascript sdk I am able
When using the Facebook Registration social plugin, the user is presented with an undo
When user visits a page which have Facebook Registration Plugin and if he is
Hi I'm using a wordpress plugin to allow user to comment using facebook and
I am implemeting a facebook application in rails using facebooker plugin, therefore it is

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.