Tuesday, May 17, 2011

One of reason's Facebook's API 'Error validating verification code.' at authentication process

Gist:
https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream


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_URL must be same on both requests.

Prose:
I have little service which used to be social platform(twttr,fb,myspace).

Today i've spent some time on fixing bug, in my implementation of server side facebook auth flow. Probably I didn't understand well strictness of flow, so I went in struggle with :

{
"error": {
"type": "OAuthException",
"message": "Error validating verification code."
}
}

Experimental way i've found that i've changed redirect_uri param on second step, so it was different with first request. Which wasn't obvious for me :].

Actually i don't understand why we need redirect_uri param in request which goes directly from script to facebook server, without user involving.

No comments:

Post a Comment