【问题标题】:Re-Authentication in Twitter DigitsTwitter Digits 中的重新身份验证
【发布时间】:2017-04-30 00:01:44
【问题描述】:

我最近才开始使用Twitter Digits

我遇到了问题,事实是,当我第一次登录时(短信带有代码,通过Authentication,并在Toast 中收到一条消息“身份验证成功”)。

但是当我第二次尝试打开页面填写号码时,我按下按钮,我再次收到一条关于成功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);
            }
        });

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

【问题讨论】:

    标签: java android twitter-digits


    【解决方案1】:

    你应该调用 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();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-15
      • 2013-01-20
      • 1970-01-01
      • 1970-01-01
      • 2016-02-23
      • 2013-07-05
      • 2011-10-05
      • 2016-06-11
      相关资源
      最近更新 更多