Google login uses same account everytime users login

前端 未结 13 1812
无人共我
无人共我 2020-12-09 11:22

I use OAuth to let users sign in to the android app via Google account. When the user taps the Google login button for the first time, it produces a dialog to choose the acc

13条回答
  •  没有蜡笔的小新
    2020-12-09 12:21

    You have to just clear pre-signed in accounts. To do so, add the following as first line under signIn() function: mGoogleSignInClient.signOut();

     private void signIn() {
        // clearing previous signin caches
           mGoogleSignInClient.signOut();
    
        //getting the google signin intent
        Intent signInIntent = mGoogleSignInClient.getSignInIntent();
        //starting the activity for result
        startActivityForResult(signInIntent, RC_SIGN_IN);
    }
    

提交回复
热议问题