Facebook的服务器端的访问令牌流问题:"错误核查验证code" [英] Facebook Server Side flow problem for Access Token: "Error validating verification code."

查看:460
本文介绍了Facebook的服务器端的访问令牌流问题:"错误核查验证code"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想收到来自Facebook的访问令牌。我一直在敲我的头这几晚现在希望另一双眼睛可以帮助我!

如记录在<α

Facebook的服务器端流量href=\"https://developers.facebook.com/docs/authentication/\">https://developers.facebook.com/docs/authentication/指出,访问令牌URL应该是这种格式。

  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

我的洁净的URL(修改CLIENT_ID,client_secret的值,code):

<$p$p><$c$c>https://graph.facebook.com/oauth/access_token?client_id=000000000000000&redirect_uri=http%3a%2f%2flocalhost%3a57260%2f&client_secret=00000aa0a000a0a000000aaaa0000a00&$c$c=0.aAaAaa_aaAaaaAAaAaA_aa__.0000.0000000000-0000000000|aAAa0AAaa0AA0aAAAAaAA0Aa0a0

我收到的错误是

  {
   错误:{
      类型:OAuthException,
      消息:无效的验证code画幅。
   }
}

我见过的多个帖子提到,REDIRECT_URI需要以斜杠(/)结束,而我有提供。在看起来可疑的对我URL的唯一的事情就是我的REDIRECT_URI HTTP端口号://本地主机:57260 / 因为这是视觉工作室是我指派的发展地址。这不符合我的网站的网址中
Facebook应用程序设置。

在此先感谢!


解决方案

最常见的错误我是REDIRECT_URI必须两个URL完全匹配:


  1. https://www.facebook.com/dia​​log/oauth ? CLIENT_ID = YOUR_APP_ID&安培; REDIRECT_URI = YOUR_URL&安培;范围=电子邮件,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

您样品return_uri URL看起来太短了(除非你在站点的根目录做身份验证)。

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!

解决方案

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

这篇关于Facebook的服务器端的访问令牌流问题:&QUOT;错误核查验证code&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆