我正在使用Facebook SDK,但我想創建相冊,但我在會話中獲得了ACCESS_TOKEN_REMOVED。AccessToken令牌:Facebook的Android SDK中的ACCESS_TOKEN_REMOVED
在會議
{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}
代碼聞聽此事。
/**
* 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);
}
SDK不會直接記錄您的訪問令牌,這就是您看到ACCESS_TOKEN_REMOVED的原因。您的請求是否出現錯誤? –
@MingLi當'call'方法執行時,我看到這個錯誤。請幫助我爲什麼如此? – user2695306
您不需要檢查「state == SessionState.CREATED_TOKEN_LOADED」,實際上,這是錯誤的檢查。只要session.isOpened()就夠了。我之前的評論是指爲了安全起見,SDK不會在logcat中記錄您的訪問令牌,這就是您看到ACCESS_TOKEN_REMOVED(而不是真正的訪問令牌)的原因。 –