Android - OAuthException - 我不断收到 : "An active access token must be used to query information about the current user"

标签 android access-token

我已经使用了这个确切的代码和其他在一定程度上起作用的代码,但我不断收到以下错误:

{"error":{"type":"OAuthException","message":"An active access token must be used to query information about the current user."}}

这是代码:我使用了我取回的 access_token 并验证了它是否可以插入我的浏览器,并且效果很好。但是这段代码似乎要么没有使用我取回的访问 token ,要么我没有设置它。我什至尝试了 FB.setAccessToken() 方法以及 params.putString("access_token", MY_ACCESS_TOKEN)。

我想知道,因为我不需要更改网站 url 的访问 token 才能工作,我不认为我不需要对 access_token 做任何特殊的事情,比如像在 url 中一样对其进行编码?

感谢您的帮助。我已经在网上搜索了几个小时的答案,但似乎没有答案。

Bundle params = new Bundle();

params.putString("message", "Test");
params.putString("name", "American Virgin");
params.putString("link", "http://bit.ly/12345");
params.putString("description", "A Freshman College Girl on a scholarship from an ...");
params.putString("picture", "http://xxx/MOV1026.jpg");

mAsyncRunner.request("me/feed", params, "POST", new TestRequestListener());

最佳答案

您是否尝试包含以下代码?

@Override  
protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
        mFacebook.authorizeCallback(requestCode, resultCode, data);  
}  

根据文档,必须包含此项,否则身份验证将无法正常运行,进而可能导致您遇到的错误。我遇到了同样的问题,但后来意识到我错过了这个。

关于Android - OAuthException - 我不断收到 : "An active access token must be used to query information about the current user",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4967202/

相关文章:

android - 我可以在 Android Studio 中为选项菜单使用数据绑定(bind)吗?

android - 因 JVM 堆空间耗尽而导致守护进程到期?

asp.net-mvc - Azure Active Directory 和单点登录的访问 token

php - 如何使用 Google API 客户端刷新 token ?

android - Google plus for android 错误的访问 token

android - 应用程序在发布时崩溃,但在 Debug模式下工作正常

java - Asynctask 中多线程意外停止

android - java.lang.NoClassDefFoundError : com. 谷歌.android.gms.common.AccountPicker

Azure AD - token 中缺少角色声明

python - Instagram API OauthException : "You must provide a client_id"