开发者

(#803) Some of the aliases you requested do not exist: access_token","type":"OAuthException"

I am trying to get access token using from facebook graph API in my rails 2.3 based web application. The request I am sending for that is :

https://graph.facebook.com/oauth/access_token?client_id=开发者_如何学JAVA<client_id>
&redirect_uri=http://localhost:3001/facebook_callback
&client_secret=<client_secret>
&code=AQBgog2NvoUYQCXsa2bGpj--s9RD71F3zTKX344cUZ-
AWX4CNhdx3Yerl_wmzQkQ4zIUFVS_CRoN0zXaEW63dHcC9sH6_
vl7ljSxwA6TLSrkWVcfdfdrmwBTlMNIzyJr0h6irGW1LCdTw8
Racgd8MQ9RgVn1gFL26epWA

And it is redirecting me to

http://localhost/facebook_callback?code=AQBgog2NvoUYQCXsa2bGpj--
s9RD71F3zTKX344cUZ AWX4CNhdx3Yerl_wmzQkQ4zIUFVS_CRoN0mAB_Sr1H4K
dXIlzXaEW63dHcC9sH6_vl7ljSxwA6TLSrkWVcfdfdrmwBTlMNIzyJr0h6irG
SxsrRAXtdviNsBTMW1LCdTw8Racgd8MQ9RgVn1gFL26epWA

I am getting error in both development and production environment . I am not able to get the access token. Has anyone else face the problem ??


This looks correct - Facebook redirects to your redirect url with the code= parameter. You then need to exchange the code for an access token. See here: http://developers.facebook.com/docs/authentication/

edit: my bad, I misread the first section. You can sometimes have problems using localhost as a redirect. Are you using a live domain without port in your non-test environment?


Well, I found solution of my problem :

The problem was with the path which I was using for request of access_token . I placed a slash in front of the path and bingo. It worked like a charm.

So instead of

oauth/access_token?client_id=#{ @client_id }&redirect_uri=#{ @redirect_uri }&client_secret=#{ @client_secret }&code=#{ code }"

we just need to use

/oauth/access_token?client_id=#{ @client_id }&redirect_uri=#{ @redirect_uri }&client_secret=#{ @client_secret }&code=#{ code }".

Thanks to all people for your efforts.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜