Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/access_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!

like image 457
proudgeekdad Avatar asked Mar 04 '11 03:03

proudgeekdad


People also ask

How can I solve FB token error?

Facebook Error: Error Validating Access Token: The User Is Enrolled In A Blocking, Logged-in Checkpoint. If you've received this error, it means that your Facebook user account has failed a security checkpoint and you need to log in at https://www.facebook.com or https://m.facebook.com to correct the issue.

What is FB token error?

Message: Error validating access token: The user is enrolled in a blocking, logged-in checkpoint. This error message means that your Facebook user account has failed a security checkpoint and needs to log in at Facebook or the Facebook Business Manager to correct the issue.

What is an Oauth exception on Facebook?

OAuthException: If you receive an OAuthException error, it means that Edgar doesn't have the correct permissions to access your Facebook accounts right now. The password may have been changed on Facebook or Facebook may have reset your security session.


1 Answers

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).

like image 166
Alexei Levenkov Avatar answered Sep 27 '22 23:09

Alexei Levenkov