facebook-如何获取访问令牌的新授权码 [英] facebook - how to get a new authorization code for an access token

查看:75
本文介绍了facebook-如何获取访问令牌的新授权码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了文档,但我不明白如何获取新代码,我这样做是为了获得令牌以读取我是管理员的网站的供稿:

I've read through the documentation and I don't understand how to get the new code, I was doing this to get a token to read the feed for a site I'm an admin on:

https://graph.facebook.com/oauth/access_token?client_id="+ sClientID +"& client_secret ="+ sSecret +"& redirect_uri ="+ sRedirectURI +"& code ="+ sCode;

https://graph.facebook.com/oauth/access_token?client_id=" + sClientID + "&client_secret=" + sSecret + "&redirect_uri=" + sRedirectURI + "&code=" + sCode;

然后:

" https://graph.facebook.com/" + sUser +"/帐户?"+ sToken;获取提要.

"https://graph.facebook.com/" + sUser + "/accounts?" + sToken; To get the feed.

它告诉我:

{
  "error": {
    "message": "This authorization code has been used.", 
    "type": "OAuthException", 
    "code": 100
  }
}

我知道我需要一个新的授权码,但是找不到在文档中调用该方法的方法.另外,还有另一种获取此提要的方法吗?

I know I need a new authorization code but cannot find the method to call to get one in the documentation. Alternatively, is there another way to get this feed?

推荐答案

步骤1:请打开浏览器,输入以下URL并点击.

STEP 1: Please open your browser, type the following URL and hit.

https://www.facebook.com/v8.0/dialog/oauth?client_id={app_id}&redirect_uri={redirect_uri}

https://www.facebook.com/v8.0/dialog/oauth?client_id={app_id}&redirect_uri={redirect_uri}

步骤2:假设您的 {redirect_uri} = https://www.abc.co.in/ .然后,您将在URL本身中收到具有以下格式的新授权码. https://www.abc.co.in/?code={get_new_auth_code_here}

STEP 2: Let's assume your {redirect_uri} = https://www.abc.co.in/. Then you will receive new authorization code with the following format in the URL itself. https://www.abc.co.in/?code={get_new_auth_code_here}

步骤3:通过具有上述新授权代码的以下网址获取访问令牌.

STEP 3: Get the access token by the following URL with said new authorization code.

https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=authorization_code&redirect_uri={redirect_uri}&code={newly_received_auth_code}

加油!

这篇关于facebook-如何获取访问令牌的新授权码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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