I'd like to develop an android app where the user can authenticate with his Google account. Then I'd like to use the Google account details also in my C# backend (not for accessing Google APIs, at least for now, but rather to spare an additional user management system). The transport layer will be gRPC. There seem to be numerous ways to do this and I chose the following for the moment:
- In Android use the GoogleSignIn client to allow the user to log on. From the SignIn client I get the account details as an ID token (which is actually a JWT)
- Send the JWT along with a gRPC call as metadata (in the RequestHeader)
- Extract the JWT on the C# backend and validate it using GoogleJsonWebSignature.ValidateAsync from the Google.Apis.Auth nuget package. This returns all the relevant info I need in the backend.
For the beginning this was all quite easy and works well. The only downside is that the JWT will eventually exipre and needs to be refreshed :-(. How the f.. do I do this?
Is this a good approach? Any other ways to do it better? How do I refresh the JWT? BR, Daniel