Facebook中是否存在不同类型的访问令牌'API

Are there different types of access tokens in Facebook's API?

本文关键字:访问令牌 API 同类型 是否 存在 Facebook      更新时间:2023-09-26

例如,生成iFrame对话框所需的access_token与登录所需的不同吗?如果是,我应该使用哪个URL来获取访问令牌,以生成作为iFrame的提要对话框?

我问这个问题是因为我尝试使用以下URL(我在文档中找到的)手动生成访问令牌

https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=client_id&client_secret=client_secret

我收到了一个访问令牌,但当我这样使用它时:

 FB.ui({
                    method: 'feed',
                    name: 'Facebook Dialogs',
                    link: 'http://developers.facebook.com/docs/reference/dialogs/',
                    picture: 'http://fbrell.com/f8.jpg',
                    caption: 'Reference Documentation',
                    description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
                    message: 'Say something about the tickets you just bought',
                    display: 'iframe',
                    access_token: ACCESS_TOKEN; //access_token returned by the above URL
                },
                function(response) {
                    if (response && response.post_id) {
                    console.log('Post was published.');
                    } else {
                    console.log('Post was not published.');
                    }
                }
                   );

facebook提要对话框将永远停留在加载屏幕上,有3个栏。

那么,我是不是请求了错误的access_token?为什么facebook对话框没有加载?

注意:这都在客户端javascript中。

是的,有不同类型的令牌。每个令牌都被分配给一个特定的"用户"。该令牌允许您作为"用户"访问选项。有两个不同的"用户",一个是真实的,另一个是您的应用程序。您可以为应用程序请求令牌,以便代表授予您"离线"访问权限的用户执行操作。您请求的是一个应用程序令牌,它不是真正的用户。