开发者

Facebook Server Side flow problem for Access Token: "Error validating verification code."

I'm trying to receive an access token from Facebook. I've been banging my head against this for a few nights now and hoping another set of eyes can help me out!

Facebook's Server-side Flow as documented on https://developers.facebook.com/docs/authentication/ states that the access token URL should be in this format.

https://graph.facebook.com/oauth/access_token?
     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&
     client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE

My cleansed URL is (modified the values of the client_id, client_secret, and code):

https://graph.facebook.com/oauth/acce开发者_Python百科ss_token?client_id=000000000000000&redirect_uri=http%3a%2f%2flocalhost%3a57260%2f&client_secret=00000aa0a000a0a000000aaaa0000a00&code=0.aAaAaa_aaAaaaAAaAaA_aa__.0000.0000000000-0000000000|aAAa0AAaa0AA0aAAAAaAA0Aa0a0

The error I receive is

{
   "error": {
      "type": "OAuthException",
      "message": "Invalid verification code format."
   }
}

I've seen multiple posts mention that the redirect_uri needs to end with a slash ("/"), and I have that provided. The only thing in the URL that looks suspicous to me is the port number as my redirect_uri http://localhost:57260/ as this is what Visual Studio is assigning my development address as. This does match my Site URL in the Facebook app settings.

Thanks in advance!


Most common error I had is that redirect_uri must match exactly in both Urls:

  1. https://www.facebook.com/dialog/oauth? client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream
  2. https://graph.facebook.com/oauth/access_token? client_id=YOUR_APP_ID&redirect_uri=YOUR_URL& client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE

Your sample return_uri url looks too short (unless you do authentication on the root of the site).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜