简体   繁体   中英

Facebook access token problem

I am connecting to login facebook page through an url. I receive the access token in my application and i can prints all my contacts from the list. I have a problem: there are times when i do receive the access token and if i logout from facebook and rebuild my application the second time , i don't have any access token. WHY? If i wait i guess 10-15 minutes and try again it works. How to resolve this? THX

I am using the auth url. THe following link was my example link: http://geekdeck.com/vb-net-facebook-get-access-token-for-desktop-application/

EDIT:

I have the following code:

browserFacebook.Navigate(@"https://graph.facebook.com/oauth/authorize?client_id="+ FacebookApplicationID + "&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup");

 string someString = browserFacebook.Url.ToString();

This returns something like the following:

"http://www.facebook.com/connect/login_success.html#access_token=ACCESS TOKEN.expires_in=0"

I can then easily use this access token with the Graph API to access an users facebook details as in the following code:

Facebook.FacebookGraphAPI g = new FacebookGraphAPI("ACCESS_TOKEN");
    var fbUser = g.GetObject("me", null);

PROBLEM:

When I rebuild the application, the link that i receive is OpenDNS (or navigation to the webpage was canceled) and I have to access token. Why? How can I resolve this error? After aa while 1-2 hours I receive again the token.

"https://graph.facebook.com/oauth/authorize?client_id=" + 
  FacebookApplicationID +  
  "&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM