firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
837 stars 434 forks source link

[Question] Connect to local Auth emulator from Unity #1229

Open DiscoverTravel opened 2 years ago

DiscoverTravel commented 2 years ago

[REQUIRED] Please fill in the following fields:

Unity editor version: 2020.3.25f1 Firebase Unity SDK version: 8.7.0 Source you installed the SDK: .unitypackage (.unitypackage or Unity Package Manager) Problematic Firebase Component: Database (Auth, Database, etc.) Other Firebase Components in use: Database, Auth, Config (Auth, Database, etc.) Additional SDKs you are using: _____ (Facebook, AdMob, etc.) Platform you are using the Unity editor on: Windows (Mac, Windows, or Linux) Platform you are targeting: Emulator (desktop) (iOS, Android, and/or desktop) Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)

[REQUIRED] Please describe the question here:

Hi, How can i connect to the authentication emulator from Unity?

Thanks

DellaBitta commented 2 years ago

Hi @DiscoverTravel,

The Firebase Unity SDK currently does not support emulators for Auth, though it's on our roadmap. I'm going to mark this issue as a Feature Request. Thanks for the ticket!

cadcri commented 1 year ago

Any news of the feature ?

khrm355 commented 1 year ago

Hello, I wanted to check if there have been any updates or workarounds regarding this feature request. I'm in the early stages of my project, and as I plan for the release of my game, I'm concerned about the ability to use functions.auth.user().onCreate-like callbacks in Cloud functions without emulator support. Any insights or alternatives would be greatly appreciated.

khrm355 commented 1 year ago

@DellaBitta , Hello again, are there any updates on the progress of this implementation?

After adding "USE_AUTH_EMULATOR" to the environment variables, Unity utilizes the emulator authentication successfully. I can confirm that login, registration, and callback functions are working as intended in the emulator.

However, a critical issue arises post-login/register:

ERROR: Could not initialize persistence: App data directory error: Could not create directory C:\Users\gokay\AppData\Local/com.****.****/localhost:9000
Crash!!!

It appears that Firebase Unity SDK is attempting to create a persistence directory named "localhost:9000," leading to a crash. The issue seems to be rooted in the fact that colons (":") cannot be used in Windows folder names.

dacostaleo commented 2 months ago

@DellaBitta , Hello again, are there any updates on the progress of this implementation?

After adding "USE_AUTH_EMULATOR" to the environment variables, Unity utilizes the emulator authentication successfully. I can confirm that login, registration, and callback functions are working as intended in the emulator.

However, a critical issue arises post-login/register:

ERROR: Could not initialize persistence: App data directory error: Could not create directory C:\Users\gokay\AppData\Local/com.****.****/localhost:9000
Crash!!!

It appears that Firebase Unity SDK is attempting to create a persistence directory named "localhost:9000," leading to a crash. The issue seems to be rooted in the fact that colons (":") cannot be used in Windows folder names.

Hi! Did you find a solution for that error? Im having the same problem trying to use firebase Emulator with Unity: ERROR: Could not initialize persistence: App data directory error: Could not create directory xxxxxx/127.0.0.1:9000

StephenHodgson commented 1 day ago

I would also like support for this as well.