Issue
I have implemented Google Signing for Android app. The user can successfully login from the Google Login Button. So now the user has logged in successfully by selecting his/her account.
Now, user logs out and tries to sign in again by using Google Login Button.
At this time, he is not asked with the option to choose account , he is automatically logged in using the account he/she selected at the first time.
At the time of logout what should I do to clear the cache of selected account.(using kotlin)
Solution
You need to Sign out from your GoogleSignInClient as well. You can use this:
private fun logout() {
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(context.getString(R.string.default_web_client_id))
.requestEmail()
.build()
val googleSignInClient = GoogleSignIn.getClient(context, gso)
googleSignInClient.signOut()
}
Answered By - Vishist Varugeese
Answer Checked By - Pedro (JavaFixing Volunteer)