ITKeyword,专注技术干货聚合推荐

注册 | 登录

java - Facebook malformed access token android

itPublisher 分享于

2020腾讯云双十一活动,全年最低!!!(领取3500元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1073

2020阿里云最低价产品入口,含代金券(新老用户有优惠),
地址https://www.aliyun.com/minisite/goods

推荐:Android使用facebook api(三)

  本文旨在介绍facebook的graph api     graph API 简介     facebook的graph api是一套REST化的api,通过统一而稳定URL定义请访问数据对象,通过对http协议的GET

I'm trying to make a Graph API call on Facebook from Java (Android).

Here's the request

new Request(
        session,
        "/me/taggable_friends?fields=name,picture.type(normal)",
        null,
        HttpMethod.GET,
        new Request.Callback() {
            public void onCompleted(Response response) {

            }
        }
    ).executeAsync();

The first error is the following

07-13 18:23:19.871: Facebook Request(3884): {Response:  responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: An active access token must be used to query information about the current user.}, isFromCache:false}

To resolve this error I put explicitly the access token on the request in this way

new Request(
        session,
        "/me/taggable_friends?fields=name,picture.type(normal)&access_token=" + session.getAccessToken(),
        null,
        HttpMethod.GET,
        new Request.Callback() {
            public void onCompleted(Response response) {
                /* handle the result */
                Log.d("Facebook Request Friends", response.toString());
            }
        }
    ).executeAsync();

and returns me this error

07-13 18:26:14.624: Facebook Request(4005): {Response:  responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 190, errorType: OAuthException, errorMessage: Malformed access token CAATukWchF0IBAEgpzi4aywNlkkieqVXbrshYhtx6mrrJiDxLIWOVI6623uA4x5ZBpwoTjyxWZArLgzHgF2nu9zZAwrnGx5kojCqWrvaj2HMPZCrqq2M2OH828IsZAxTRsdCQecJaH1mgCZBRls7BZASh96F9oDVKBdLrxqZAQkmFoFetGwCZABaXkT9jjIZD?access_token=CAATukWchF0IBAEgpzi4aywNlkkieqVXbrshYhtx6mrrJiDxLIWOVI6623uA4x5ZBpwoTjyxWZArLgzHgF2nu9zZAwrnGx5kojCqWrvaj2HMPZCrqq2M2OH828IsZAxTRsdCQecJaH1mgCZBRls7BZASh96F9oDVKBdLrxqZAQkmFoFetGwCZABaXkT9jjIZD}, isFromCache:false}

I have a malformed access_token but is taken from getAccessToken().

I don't understand why my access token is written twice in logcat as you can see. Like [ACCESS_TOKEN]?access_token=[ACCESS_TOKEN]??

I tried also to print in logcat the result of getAccessToken() and is correct.

推荐:向iOS SDK看齐:Facebook Android SDK迎来重大更新

摘要:继去年12月份3.0版本之后,Facebook Android SDK终于迎来重大更新。全新的Android SDK功能将与今年4月份更新的iOS SDK保持一致,Facebook为iOS开发者提供

Facebook app is configured, permissions are okay, and in Graph API Explorer works with the same access_token!

Does the access token can be specified in another way on the request?

I don't know how to resolve this issue, I hope you do.

Thanks in advice.

java android facebook-graph-api facebook-android-sdk facebook-access-token
|
  this question
asked Jul 13 '14 at 18:39 Outofmind 16 4      Did you check the value of session.getAccessToken() before sending it? –  JohnnyWineShirt Jul 13 '14 at 18:52      Yes "I tried also to print in logcat the result of getAccessToken() and is correct." –  Outofmind Jul 13 '14 at 18:57      just edited my answer –  JohnnyWineShirt Jul 13 '14 at 19:08      Is the session parameter a valid Session object? Based on the documentation access token should be handled automatically as long as it is. –  harism Jul 13 '14 at 21:16      Yes, I'm using Parse to manage the session and integrating with Facebook. Session is provided by ParseFacebookUtils –  Outofmind Jul 13 '14 at 21:43

 | 

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

推荐:Android使用facebook api(二)

本文重点介绍下facebook接入的一些背景知识,本身其实与android是无关的。   Facebook Connect   facebook connect协议是OpenID与OAuth的结合,第三方站点/应用


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。