AccessToken token:ACCESS_TOKEN_REMOVED in Facebook Android SDK

user2695306 picture user2695306 · Aug 19, 2013 · Viewed 29.2k times · Source

I am using the Facebook SDK but I want to create the photo album but I am getting ACCESS_TOKEN_REMOVED in the session.

Getting this in session

{Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[read_stream, manage_friendlists, read_mailbox, status_update, photo_upload, video_upload, sms, create_event, rsvp_event, email, xmpp_login, create_note, share_item, publish_stream, ads_management, read_insights, read_requests, manage_notifications, read_friendlists, manage_pages, publish_actions, user_birthday, user_religion_politics, user_relationships, user_relationship_details, user_hometown, user_location, user_likes, user_activities, user_interests, user_education_history, user_work_history, user_online_presence, user_website, user_groups, user_events, user_photos, user_videos, user_photo_video_tags, user_notes, user_checkins, user_about_me, user_status, basic_info]}, appId:458921577539675}

Code.

/**
 * Connect to facebook using Facebook SDK.
 */
public void connectToFacebook() {
    Session session = Session.getActiveSession();
    if(session == null || session.isClosed()) {
        Session.openActiveSession((Activity)context, true, new StatusCallback() {
            @Override
            public void call(Session session, SessionState state, Exception exception) {
                if(session.isOpened() && state == SessionState.CREATED_TOKEN_LOADED) {
                    Log.v(GlobalVars.TAG, "Token::" + session.getAccessToken());
                    Request.executeMeRequestAsync(session, new GraphUserCallback() {
                        @Override
                        public void onCompleted(GraphUser user, Response response) {
                            if(response != null) {
                                Log.v(GlobalVars.TAG, "Response::" + response);
                                Log.v(GlobalVars.TAG, "Response::" + user.getFirstName() + ":::" + user.getLastName());
                            }
                        }
                    });
                }
            }
        });
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}

Answer

emidander picture emidander · May 6, 2015

If you are just seeing ACCESS_TOKEN_REMOVED in your log, make sure you are printing session.getAccessToken().getToken(). In the example above, replace

Log.v(GlobalVars.TAG, "Token::" + session.getAccessToken());

with

Log.v(GlobalVars.TAG, "Token::" + session.getAccessToken().getToken());