简体   繁体   English

获取“ facebook代码”以从服务器端获取长期访问令牌。 Django的

[英]Getting the “facebook code” to obtain long-lived-access-token from server side. Django

I'm trying to follow this doc to get a long-lived user token. 我正在尝试按照此文档获取长期存在的用户令牌。 (see "Generating Long-Lived User Tokens from Server-Side Long-Lived Tokens") (请参阅“从服务器端长期令牌生成长期用户令牌”)

The diagram is quite explicit, and I thought it should be easy. 该图非常明确,我认为应该很容易。

But the problem comes when I try to get the "code." 但是问题出在我尝试获取“代码”时。

As you can see, this should be the request: 如您所见,这应该是请求:

https://graph.facebook.com/oauth/client_code?access_token=...&client_secret=...&redirect_uri=...&client_id=...

But the problem is that since I'm on the Server side, I'm not able to redirect the user since that's a client work. 但是问题在于,由于我在服务器端,因此无法重定向用户,因为这是客户端工作。 (Isn't it?) (不是吗?)

So, since I got this error: 因此,由于出现此错误:

{
  "error": {
    "message": "Missing redirect_uri parameter.",
    "type": "OAuthException",
    "code": 191,
    "fbtrace_id": "EqPakhHX9i6"
  }
}

I tried this: 我尝试了这个:

&redirect_uri=https://www.google.com/& (to see if it eats that URI) (看它是否吃了那个URI)

But no chance. 但是没有机会。

I was looking for similar questions, but people use to use the client side, and I don't have any access to the Client. 我一直在寻找类似的问题,但是人们经常使用客户端,但是我对客户端没有任何访问权限。 Actually, the client is waiting for this code from me, as the diagram shows. 如图所示,实际上,客户端正在等待我的这段code

So, I don't have any idea how I can do it. 所以,我不知道该怎么做。

Maybe someone here had the same problem. 也许有人在这里有同样的问题。

仅将下一个网址与cURL一起使用:

https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={client-id}&client_secret={secret-id}&fb_exchange_token={short-token}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM