Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Support to launch two desktop standalone instances using Auth #967

Open
HarrisonShort opened this issue Feb 25, 2021 · 2 comments
Open

Comments

@HarrisonShort
Copy link

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.13f1
  • Firebase Unity SDK version: 6.16.1
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: Auth
  • Other Firebase Components in use: App (Core), Cloud Messaging, Dynamic Links, Instance ID, Realtime Database, Cloud Storage, Cloud Functions
  • Additional SDKs you are using: Facebook
  • Platform you are using the Unity editor on: N/A
  • Platform you are targeting: MacOS
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

Having multiple builds on the one Mac with different names causes SaveUserData and DeleteUserData keychain errors. It seems as if the delete error appears once, followed by the adding error, and then the deleting error once more.

Error -25299 adding <app>.firebase.auth/__FIRAPP_DEFAULT: The specified item already exists in the keychain.
Error -25244 deleting <app>.firebase.auth/__FIRAPP_DEFAULT: Invalid attempt to change the owner of this item.

While this appears to mostly only be an issue for our dev team, we just want to find out whether there is anything we can do about it, as theoretically it could happen to end-users. Our builds are distributed through direct website downloads, rather than the Mac App Store, which means in the unlikely event that someone keeps an old build and renames it to something, this may occur.

Steps to reproduce:

  1. Create two versions of application using Firebase Auth for login, with different names (appending "copy" to the end of the name is sufficient).
  2. Clear keychain of anything related to application.
  3. Open primary build instance.
  4. Sign into any account.
  5. Application password is created in keychain.
  6. Open secondary build instance.
  7. Errors will occur.
@chkuang-g
Copy link
Contributor

@HarrisonShort

Just to clarify: Are you trying to build standalone Mac desktop application using Firebase SDK?

I believe this is related to the persistent storage in Auth. On Mac, the login status and tokens are stored in keychain named
<your-package-name>.firebase.auth/<name-of-FirebaseApp>

That is, given that your package name and FirebaseApp is not changed for your two versions, they will be stored with the same name in keychain. The second instance will not be able to access the keychain and therefore cause the error.

Unfortunately, this is not a supported scenario for Firebase desktop implementation now. We only expect one instance per desktop, primarily to support running in Unity editor. See also #928. This is a different issue but not supported currently.

May I understand your use case to launch two instances on the same desktop? As I said, as long as either package name or FirebaseApp name is different, Auth API should store the persistent data in different key name.

  • package name on the desktop should be the same to the app name you set in Firebase console.
  • FirebaseApp name can be changed when you create FirebaseApp. See this API. It is default to __FIRAPP_DEFAULT

I will change this to a feature request. Let me know if the workaround works for your case.

Shawn

@chkuang-g chkuang-g changed the title Multiple builds named differently on one Mac causes keychain errors [Bug] [FR] Support to launch two desktop standalone instances using Auth Mar 5, 2021
@HarrisonShort
Copy link
Author

@chkuang-g

Yes, we have a companion program to our main Android and iOS app that runs on standalone desktop platforms.

Thanks for getting back to us on this. For more clarification, we are not attempting to run two instances at the same time, but because we provide a direct download to the standalone Mac program it is possible for users to have two different builds of the same app on their computers (especially in the case that we push an update). When one is named differently to the other, the second instance will throw these errors.

All things considered, this is quite a specific edge case and we understand that it is unlikely to receive much attention since it doesn't effectively break anything. I will try the workaround and report back.

Thanks again. (:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants