尝试获取应用访问令牌 [英] trying to get app access token

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

问题描述

我尝试使用以下代码为我的 facebook 应用获取应用访问令牌:

I tried to get an app-access-token for my facebook app with this code:

APP_ACCESS_TOKEN = FB.api(
    "oauth/access_token",
    {client_id: APP_ID, client_secret: APP_SECRET_CODE, redirect_uri: uri},
    function(response){
    console.log(response);
});

应该是这样的:

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

但我收到一个错误:

code: 1
message: "Missing authorization code"
type: "OAuthException"

授权码是什么,如何获取?

What is the authorization code and how can i get it?

推荐答案

获取应用访问令牌

要获取应用访问令牌,请调用以下 HTTP GET 请求:

To obtain an App Access Token, invoke the following HTTP GET request:

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

API 将使用以下形式的查询字符串格式的字符串进行响应:

The API will respond with a query-string formatted string of the form:

access_token=YOUR_APP_ID|YOUR_APP_ACCESS_TOKEN

参考:http://developers.facebook.com/docs/opengraph/howtos/publishing-with-app-token/

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

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