Note that there are some explanatory texts on larger screens.

plurals
  1. PONew Facebook sdk: Issue accessing graph api
    text
    copied!<p>I am using the new facebook sdk in android to get the facebook albums. The code I am using is,</p> <pre><code>Session session = Session.getActiveSession(); Request request = new Request(null, "https://graph.facebook.com/me/albums?access_token=" + session.getAccessToken()); Response response = Request.executeAndWait(request) </code></pre> <p>When I do a <code>https://graph.facebook.com/me/albums?access_token=ACCESSTOKEN</code> I see the valid <code>Json</code>.</p> <p>The request object is,</p> <pre><code>{Request: session: {Session state:OPENED_TOKEN_UPDATED, token: {AccessToken token:ACCESSTOKEN permissions:[photo_upload, publish_stream, video_upload, share_item, installed, user_photos, status_update, create_note, publish_actions]}, appId:281846961912565}, graphPath: https://graph.facebook.com/me/albums? access_token=ACCESSTOKEN, graphObject: null, restMethod: null, httpMethod: GET, parameters: Bundle[{migration_bundle=fbsdk:20121026}]} </code></pre> <p>But when I do a <code>Response response = Request.executeAndWait(request);</code> I get </p> <pre><code>{Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 190, errorType: OAuthException, errorMessage: Malformed access token ACCESSTOKEN?format=json}, isFromCache:false} </code></pre> <p>Complete code is as follows:</p> <pre><code>private class FetchUserPhotos extends AsyncTask&lt;String, Integer, Boolean&gt; { private ProgressDialog pd = null; @Override protected void onPreExecute() { super.onPreExecute(); pd = ProgressDialog.show(MainActivity.this, "WWD", "Fetching photos..", true, true); } @Override protected Boolean doInBackground(String... params) { Session session = Session.getActiveSession(); Request request = new Request(null, "https://graph.facebook.com/me/albums?access_token=" + session.getAccessToken()); Response response = request.executeAndWait(); return true; } @Override protected void onPostExecute(Boolean result) { pd.dismiss(); } } </code></pre> <p>Could any of you please tell me if there is something wrong in the way i am accessing it please?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload