- Newest
- Most votes
- Most comments
When migrating from Google Play Games Services v1 to v2 for use with Amazon Cognito, you'll need to adapt your token retrieval approach since the PlayGamesPlatform.Instance.GetIdToken() method is no longer available in v2.
In Play Games Services v2, you'll need to use the new authentication flow to obtain an OpenID Connect authentication token that can be used with Amazon Cognito. After authenticating the user with Google Play services, you should request the authentication token directly from Google's authentication services.
The general approach would be:
- Authenticate the user using Play Games Services v2
- Use the Google Auth utility to retrieve the token with the appropriate scope
- Add this token to your Cognito credentials provider
Your code would look something like:
// After authenticating with Play Games Services v2
string token = GoogleAuthUtil.getToken(context, accountName, "audience:server:client_id:YOUR_GOOGLE_CLIENT_ID");
// Then use this token with Cognito
Credentials.AddLogin("accounts.google.com", token);
Make sure to replace YOUR_GOOGLE_CLIENT_ID with the client ID from your Google Developers console project. This token will allow Amazon Cognito to authenticate the user and generate a unique identifier, maintaining the same functionality you had with v1 but using the updated API methods from v2.
Remember that when working with the new API, you'll need to handle the authentication flow according to Google's updated documentation for Play Games Services v2, as the implementation details have changed from v1.
Sources
Setting up Google as an identity pool IdP - Amazon Cognito
Integration between Google sign in and Amazon Cognito | AWS re:Post
Getting credentials - Amazon Cognito
answered a year ago
Relevant content
asked 2 years ago

Tried with the following code:
However, accounts array is empty. Possibly because GoogleAuthUtil is deprecated ?