Twitter 数字中的重新验证

Re-Authentication in Twitter Digits

我最近才开始使用 Twitter Digits

我遇到了问题,事实是当我第一次登录时(带有代码的短信进入,经过 Authentication,并在 Toast "Authentication successful for").

但是当我第二次尝试打开页面填写数字时,我按下按钮,我再次收到一条关于成功的消息 authentication

onCreate 方法中的代码:

DigitsAuthButton digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button);
        digitsButton.setCallback(new AuthCallback() {
            @Override
            public void success(DigitsSession session, String phoneNumber) {
                // TODO: associate the session userID with your user model
                Toast.makeText(getApplicationContext(), "Authentication successful for "
                        + phoneNumber, Toast.LENGTH_LONG).show();
            }

            @Override
            public void failure(DigitsException exception) {
                Log.d("Digits", "Sign in with Digits failure", exception);
            }
        });

问:如何清除会话或重新授权?

你应该调用 Digits.logout()

/**
 * Log user out of this device - this clears the active Digits session, if one exists
 * Note: You will no longer get updates to the user's profile information
 * (email, phone number, etc) without an active Digits session.
 */
public static void logout(){
    getInstance().sessionManager.clearActiveSession();
}

调用前

Digits.authenticate();