question

philipphertel avatar image
philipphertel asked

Login With Google after closing app,Login With Google Account second time

Hello everyone,

currently i sign up my users with


LoginWithGoogle, using the server auth code.

The moment the users close and reopen the app,

I call this in my android app:

GoogleSignInAccount googleSignInAccount = GoogleSignIn.getLastSignedInAccount(activity);

I can't retrieve a server auth code a second time, only the account id, if the user is already logged in.

(To do so I'd have to sign out and in the user everytime he opens the app to my understanding)

Is there any way to sign in again e.g. with the account id?

,

Hello Everyone!

LoginWithGoogle does only work with the AuthCode, which is a one time code.

My current flow is like this:

first, LoginWithGoogle

(or, if the user does not want to login: LoginWithDeviceID and later link a google account)

My question is, when the user closes and restarts the app, I can only retrieve the account ID and no new server auth code from the android application

GoogleSignInAccount googleSignInAccount = GoogleSignIn.getLastSignedInAccount(activity);

How do I login the user again, after the initial sign up?

Authenticationandroid
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Hernando avatar image
Hernando answered

According to this Google documentation: Enabling Server-Side Access, after the user successfully signs in, you can call getServerAuthCode() method to obtain the one-time server auth code. Please let me know if you have any questions.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.