# Add google credentials flag to Nakama Configuration

**URL:** <https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864>\
**Category:** Local Setup\
**Tags:** server-framework\
**Created:** [May 12, 2023, 7:05am UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864 "2023-05-12T07:05:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![UmarBhatPlaystrom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/umarbhatplaystrom/32/1635_2.png) [@UmarBhatPlaystrom](https://forum.heroiclabs.com/u/UmarBhatPlaystrom)\
**Post date:** [May 12, 2023, 7:05am UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/1 "2023-05-12T07:05:46Z")

</div>

According to documentation’s [this](https://heroiclabs.com/docs/nakama/concepts/authentication/#google) section I must setup google\_play\_auth.credentials\_json flag in my Nakama Configuration. I’ve found no such flag. I tried to set it up using my docker compose file:

nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&  
exec /nakama/nakama --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama --google\_auth.credentials\_json /nakama/data/google\_auth.json

And got this error:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/e/efdb37151b62887b34cf8ed3d9c30dcfad985738.jpeg)

Also I tried to add it directly to the configuration file:

google\_auth:  
credentials\_json: “/nakama/data/google\_auth.json”

Is this flag obsolete? Or if it is not how exactly should I add it?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [May 12, 2023, 10:00am UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/2 "2023-05-12T10:00:55Z")

</div>

The flag was recently introduced, please ensure you’re on the latest release of Nakama (3.16.0).

---

<div class="post-metadata">

**Author:** ![UmarBhatPlaystrom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/umarbhatplaystrom/32/1635_2.png) [@UmarBhatPlaystrom](https://forum.heroiclabs.com/u/UmarBhatPlaystrom)\
**Post date:** [May 12, 2023, 1:27pm UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/3 "2023-05-12T13:27:07Z")

</div>

Thank you, @sesposito, that was not mentioned in the documentation!  
By the way we still have some issues with that.

**Here is json format that we try to pass to config:**

{  
“web”: {  
“client\_id”: “”,  
“project\_id”: “”,  
“auth\_uri”: “[Sign in - Google Accounts](https://accounts.google.com/o/oauth2/auth)”,  
“token\_uri”: “[https://oauth2.googleapis.com/token](https://oauth2.googleapis.com/token)”,  
“auth\_provider\_x509\_cert\_url”: “[https://www.googleapis.com/oauth2/v1/certs](https://www.googleapis.com/oauth2/v1/certs)”,  
“client\_secret”: “”  
}  
}

**Here is what error we get:**

{“level”:“info”,“ts”:“2023-05-12T12:54:48.421Z”,“caller”:“server/config.go:89”,“msg”:“Successfully loaded config file”,“path”:“/nakama/data/local.yml”}  
{“level”:“fatal”,“ts”:“2023-05-12T12:54:48.425Z”,“caller”:“server/config.go:117”,“msg”:“Failed to parse Google’s crendentials JSON”,“error”:“invalid character ‘/’ looking for beginning of value”}

What are we doing wrong?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [May 12, 2023, 1:54pm UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/4 "2023-05-12T13:54:39Z")

</div>

I missed how you were passing the config, it cannot be a path, it must be the serialised json string, something like: ` --google_auth.credentials_json='{"web":{"client_id":"","project_id":"","auth_uri":"","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"","redirect_uris":[""]}}'`

Be sure you config a redirect\_url in your Google Config and regenerate the JSON config or it will be invalid.

---

<div class="post-metadata">

**Author:** ![UmarBhatPlaystrom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/umarbhatplaystrom/32/1635_2.png) [@UmarBhatPlaystrom](https://forum.heroiclabs.com/u/UmarBhatPlaystrom)\
**Post date:** [May 12, 2023, 2:13pm UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/5 "2023-05-12T14:13:59Z")

</div>

@sesposito You helped me a lot! I’ve got a final question:)  
AuthenticateGoogleAsync() takes in a JWT token, but GPGS-unity integration doesn’t provide one. Even the PlayerIdToken, that we can obtain by using web client id is not a JWT token. How can we obtain that web client id?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [May 12, 2023, 2:41pm UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/6 "2023-05-12T14:41:47Z")

</div>

I believe the JWT token should be supported, have you tried using one in `AuthenticateGoogleAsync`?

---

<div class="post-metadata">

**Author:** ![UmarBhatPlaystrom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/umarbhatplaystrom/32/1635_2.png) [@UmarBhatPlaystrom](https://forum.heroiclabs.com/u/UmarBhatPlaystrom)\
**Post date:** [May 12, 2023, 2:45pm UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/7 "2023-05-12T14:45:06Z")

</div>

`AuthenticateGoogleAsync` is actually what I am trying to use. But it takes in a JWT token. I don’t have one, because what GPGS actually provide is not a JWT token.

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [May 12, 2023, 2:53pm UTC](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864/8 "2023-05-12T14:53:20Z")

</div>

I misread, `AuthenticateGoogleAsync()` also supports the new Google Authentication flow, so not only JWT, I’m not sure what the client id you refer would be, you should have a look at: [Enabling Server-Side Access to Google Play Games Services &nbsp;|&nbsp; Google Developers](https://developers.google.com/games/services/android/offline-access)  
and  
[Heroic Labs Documentation | Authentication](https://heroiclabs.com/docs/nakama/concepts/authentication/#google)
