Android Google+ integration - repeated UserRecoverableAuthException

前端 未结 8 1748
独厮守ぢ
独厮守ぢ 2020-11-30 00:55

We have contacted Google about this and we are on chat

The issue seems to be fixed for devices except Samsung phones.

I\'m

8条回答
  •  情书的邮戳
    2020-11-30 01:25

    I've had this issue for a while and came up with a proper solution.

    String token = GoogleAuthUtil.getToken(this, accountName, scopeString, appActivities);
    

    This line will either return the one time token or will trigger the UserRecoverableAuthException. On the Google Plus Sign In guide, it says to open the proper recovery activity.

    startActivityForResult(e.getIntent(), RECOVERABLE_REQUEST_CODE);
    

    When the activity returns with the result, it will come back with few extras in the intent and that is where the new token resides :

    @Override
    protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
        if (requestCode == RECOVERABLE_REQUEST_CODE && responseCode == RESULT_OK) {
            Bundle extra = intent.getExtras();
            String oneTimeToken = extra.getString("authtoken");
        }
    }
    

    With the new oneTimeToken given from the extra, you can submit to the server to connect properly.

    I hope this helps!

提交回复
热议问题