Is any way for integrate firebase and Unity Gaming Services?

I use Firebase auth, database and I want use UGS. But UGS not support Firebase auth. So I thought a method:

  • Sign in with firebase,
  • Create a user document in firestore,
  • anonym sign in UGS,
  • after save token to my firestore document(only user read and write),
    In this way if user sign in other device game get token from firestore and login in UGS.

But this is have some important problems:
Security: Storing the player’s token in an external database can be dangerous.
Possibilty: I dont make any demo for try this because I dont find any options for get anonymous token and change.

So my questions:

  • Is any way for integrate firebase and Unity Gaming Services?
  • Do you think my method makes sense?
  • If my method is makes sense. How can I get user session token and use in login.

I wish, if is possible, Unity add email/password auth, database in UGS.

im trying too, you got any update?

hello there!
any update?
have you tried using OpenID Connect?

Hello, I was able to connect Firebase and Unity Gaming Services with OpenID, but if the user token changes (due to a password change or token expiration), the user session is lost. So, if you want to link Firebase and Unity Gaming Services, you can either use Firebase functions or consider using alternative services to Firebase.
I should mention, however, that it’s been a long time since I last used Unity. Some things may have changed, and I might not be able to help much.
I recommend this article: Link. This article explains how to connect other OpenID providers, including Firebase.

1 Like

Thanks for your response, @Singular-Programmer .

To address this situation, I opted to use the same authentication method that I previously implemented with Firebase—specifically, Google Play. In Unity, I authenticate the user using Google Play and then store the unique ID generated by Unity in my database. The only catch was that I needed two authentication codes from Google Play—one for Firebase and another for Unity. This is because each authentication code can only be used once within a short time frame.

The approach of using OpenID would require upgrading the Firebase billing plan, which would reduce the number of active users per month from 50k to just 3k. Additionally, you need to activate the authentication method from the Firebase console. The rest is straightforward and just involves following the documentation.

This was just my approach, though—feel free to ask questions or share your own solutions!

Happy coding!

Hello, I found a solution with using Custom Tokens. You first sign-in with UGS and get user id. Then, with that user id, you generate custom token with Firebase Functions. Finally you sign-in to Firebase with the token.

1 Like