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

  • SEARCH
  • Home
  • 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 8192475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:11:23+00:00 2026-06-07T04:11:23+00:00

I am using Facebook C# SDK version 6.0.20 to authenticate the user. It worked

  • 0

I am using Facebook C# SDK version 6.0.20 to authenticate the user.

It worked fine for me and I was able to get the user’s first and last names. But when I tried at a later time, I am getting the access token, but fbClient.Get(“me”) is failing with the following error:

(OAuthException – #190) Error validating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.

Please help.

I run the following code when user is redirected back from the auth dialog:

protected void Page_Load(object sender, EventArgs e)
{
    if (Request.Params["code"] != null)
    {
      Facebook.FacebookClient fbClient = new Facebook.FacebookClient(GetAccessToken());

        dynamic me = fbClient.Get("me");

        string firstName = me.first_name;
        string lastName = me.last_name;
        string email = me.email;
        string userID = me.id;
        string gender = me.gender;
        string dob = me.birthday;
        string locale = me.locale;
        string mStatus = me.relationship_status;            
    }

}

private string GetAccessToken()
{
    if (HttpRuntime.Cache["access_token"] == null)
    {
        Dictionary<string, string> args = GetOauthTokens(Request.Params["code"]);
        HttpRuntime.Cache.Insert("access_token", args["access_token"], null, DateTime.Now.AddMinutes(Convert.ToDouble(args["expires"])), TimeSpan.Zero);
    }

    return HttpRuntime.Cache["access_token"].ToString();
}

private Dictionary<string, string> GetOauthTokens(string code)
{
    Dictionary<string, string> tokens = new Dictionary<string, string>();

    string clientId = "xxxxxxxxxxxxxxxxxx";
    string redirectUrl = "http://localhost:51215/TestFBWebSite/FacebookRedirect.aspx";
    string clientSecret = "xxxxxxxxxxxxxxxxxxxxxx";

    string url = string.Format("https://graph.facebook.com/oauth/access_token?  client_id={0}&redirect_uri={1}&client_secret={2}&code={3}",
                    clientId, redirectUrl, clientSecret, code);

    HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
    {
        StreamReader reader = new StreamReader(response.GetResponseStream());
        string retVal = reader.ReadToEnd();

        foreach (string token in retVal.Split('&'))
        {
            tokens.Add(token.Substring(0, token.IndexOf("=")),
                token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
        }
    }

    return tokens;
}
  • 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-07T04:11:24+00:00Added an answer on June 7, 2026 at 4:11 am

    fbClient.Get(“me”) does work (without a preceding “/”), that’s what we are using and it works correctly.

    string redirectUrl = "http://localhost:51215/TestFBWebSite/FacebookRedirect.aspx";
    

    I noticed this part – I had found that the integration does not work when using localhost (or 127.0.0.1), we resolved this by setting up a host record for “test.mydomain.com” to point to 127.0.0.1

    We are encountering the #190 error as well very occasionally in our live environment. It is strange, as the location that is generating the error should only ever be triggered once Facebook has just authenticated the user, so the auth token should not have expired already!
    We are coding to handle this error (ie. don’t authenticate the user onto our system), however so far the two possibilities that I can think of as causes of the problem are:

    1. We are calling Facebook too quickly after getting the token – could be a possibility if there is a replication delay at Facebook passing the new Auth Token to all the relevant servers
    2. General internal error at Facebook

    I think it’s probably option 1, however I’ve not found enough information to back it up yet

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Facebook C# SDK and trying to authenticate my user. The first
I am using Facebook PHP SDK to authenticate the user. After generating the LoginUrl
I am using Facebook SDK in hackbook and tried to login and do all
I am using facebook PHP SDK. After the user allows my application, facebook redirects
We are using Facebook JavaScript SDK to authenticate our Facebook application. The application is
Good afternoon, I'm using version 5.4.1 of the Facebook C# SDK. I should note
How to obtain an access token from the user using Facebook C# SDK (v6).
I am using a modified version php-sdk version 3.0.0 sample code at github.com/facebook within
originally i was using a .net sdk for facebook found here: http://facebooktoolkit.codeplex.com/ but now,
I am currently using Facebook C# SDK most recent version with Facebook's JavaScript SDK

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.