Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AccessToken token:ACCESS_TOKEN_REMOVED in Facebook Android SDK

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); } 
like image 418
user2695306 Avatar asked Aug 19 '13 06:08

user2695306


People also ask

How can I get Facebook token in android?

To get the Client Access Token for an app, do the following: Sign into your developer account. On the Apps page, select an app to open the dashboard for that app. On the Dashboard, navigate to Settings > Advanced > Security > Client token.


1 Answers

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()); 
like image 168
emidander Avatar answered Oct 17 '22 09:10

emidander