要获得访问令牌Facebook的API [英] To Get the Access Token for facebook api

查看:345
本文介绍了要获得访问令牌Facebook的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要获得访问令牌,

  GET:https://graph.facebook.com/oauth/access_token? 
的client_id = YOUR_APP_ID
和client_secret = YOUR_APP_SECRET
和REDIRECT_URI = URI

我试过下面GET方法中的图形API浏览器

  / OAuth的/的access_token? CLIENT_ID = XXXXX&安培; client_secret = XXXXXXXXXXXXX&安培; REDIRECT_URI = HTTP://XYZ.com/ 

但在这里我我得到错误:

  {
错误:{
消息:缺少授权码,
类型:OAuthException,
代码:1
}
}

您可以请建议,我应该在的代码参数来传递。

  /oauth/access_token?client_id=XXXXXX&client_secret=XXXXXXXXXXXXXXX&redirect_uri=http://XYZ.com/&code=? 


解决方案

您GET参数不正确。相反,使用:

  https://graph.facebook.com/oauth/access_token?client_id=XXXXX&client_secret=XXXX& grant_type = client_credentials 

傻冒缺少



< BLOCKQUOTE>

grant_type = client_credentials




参数/值的组合,这是为了获得访问令牌需要。


To get the Access Token,

GET: https://graph.facebook.com/oauth/access_token?
        client_id=YOUR_APP_ID
       &client_secret=YOUR_APP_SECRET
       &redirect_uri=uri

I tried with below GET method in Graph API Explorer

/oauth/access_token?client_id=XXXXX&client_secret=XXXXXXXXXXXXX&redirect_uri=http://XYZ.com/

But here I am getting error:

{
  "error": {
    "message": "Missing authorization code",
    "type": "OAuthException",
    "code": 1
  }
}

Can you please suggest, What should be pass in of Code Parameter.

/oauth/access_token?client_id=XXXXXX&client_secret=XXXXXXXXXXXXXXX&redirect_uri=http://XYZ.com/&code=??

解决方案

Your GET parameters are incorrect. Instead use this:

https://graph.facebook.com/oauth/access_token?client_id=XXXXX&client_secret=XXXX&grant_type=client_credentials

Your'e missing the

grant_type=client_credentials

parameter/value combination, which is required in order to receive access token.

这篇关于要获得访问令牌Facebook的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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