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

tvOS Cloud-Synced Auth #8878

Closed
nidegen opened this issue Oct 28, 2021 · 20 comments
Closed

tvOS Cloud-Synced Auth #8878

nidegen opened this issue Oct 28, 2021 · 20 comments

Comments

@nidegen
Copy link

nidegen commented Oct 28, 2021

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 13.1
  • Firebase SDK version: 8.9.0
  • Installation method: Swift Package Manager
  • Firebase Component: Auth

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

Following this, I do share Auth over iCloud Keychain sync between iOS and macOS apps successfully.

However, if I try this with tvOS, it does not work. Does tvOS maybe not support Keychain Sharing?

Officially, tvOS supports it but there are some other users with issues.

I wonder if there could be an issue with Firebase's keychain access implementation.

Relevant Code:


    var tempUser: Firebase.User?
    do {
      try tempUser = Auth.auth().getStoredUser(forAccessGroup: accessGroupId)
    } catch let error as NSError {
      print("Error getting stored user: %@", error)
    }
    return tempUser // always nil
@paulb777 paulb777 added the tvOS label Oct 28, 2021
@ncooke3 ncooke3 self-assigned this Nov 9, 2021
@nidegen
Copy link
Author

nidegen commented Dec 11, 2021

@ncooke3 any news here? Is this even supposed to be working?

@ncooke3
Copy link
Member

ncooke3 commented Dec 12, 2021

Hi @nidegen, apologies for the delay. No updates as of now. I'll look into it this week and report back.

@nidegen
Copy link
Author

nidegen commented Dec 13, 2021

No worries, thank you!

@weixifan
Copy link

I filed an internal b/212482016 to track this.

@nidegen
Copy link
Author

nidegen commented Dec 30, 2021

nice! @weixifan so you can confirm this is not only an issue on my side, right?

@nidegen
Copy link
Author

nidegen commented Jan 18, 2022

Hi guys, how is it looking? Can you confirm this is a real bug?

@ncooke3
Copy link
Member

ncooke3 commented Jan 19, 2022

Hi @nidegen, sincere apologies for the delay. I'm working on reproducing the issue today. I have some questions:

  1. Do you have an entitlements file associated with your tvOS target? Could you confirm that its contents match/correspond to that of your other targets?
  2. Is an error being thrown? If so, could you share the underlying error message?
    Thanks!

@nidegen
Copy link
Author

nidegen commented Jan 19, 2022

No worries! Unfortunately I am pretty sure everything is correct. I have it running for iOS and macOS. The thing is however that I am not sure if it is at all possible on tvOS. Some forum posts indicate that it could be unsupported: https://developer.apple.com/forums/thread/690714

So, I am still not sure if I should expect an error on my side or if I should give up:)

@nidegen
Copy link
Author

nidegen commented Jan 19, 2022

P.S.: There is no error, just nil on Auth.auth().getStoredUser(forAccessGroup: accessGroupId)

@ncooke3
Copy link
Member

ncooke3 commented Jan 20, 2022

Hi @nidegen,

I was able to reproduce the issue without using Firebase. I created three apps: an iOS app, a macOS app, and a tvOS app. I followed Apple's Sharing Access to Keychain Items Among a Collection of Apps documentation.

I was able to share and sync password data between iOS and macOS but couldn't get tvOS to work either. The underlying error code I'm seeing from the Apple's Security framework is -25300. This code is an errSecItemNotFound which I believe explains why Firebase is returning a nil user in your case.

I reproduced on a tvOS simulator. Are you using a physical tvOS device or the simulator?

@nidegen
Copy link
Author

nidegen commented Jan 20, 2022 via email

@ncooke3
Copy link
Member

ncooke3 commented Jan 20, 2022

Ah, I was hoping that testing on a physical tvOS device would work but I guess not :( Thanks for the thorough investigation.

It appears then that this issue isn't caused by Firebase and seems to be on Apple's side– which is quite confusing since Apple's documentation indicates that this should be supported. 🤔

I think the next step would be to file feedback with Apple as this seems like unexpected behavior. I'm going to close this issue but I'm happy to continue the conversation.

@ncooke3 ncooke3 closed this as completed Jan 20, 2022
@nidegen
Copy link
Author

nidegen commented Jan 21, 2022

Yes, that confirms my suspicion. Should I file an Apple feedback? Can you maybe share your MWE?

@ncooke3
Copy link
Member

ncooke3 commented Jan 21, 2022

I'm packaging up my MWE and will share it when ready. I'll also file a feedback.

@ncooke3
Copy link
Member

ncooke3 commented Jan 21, 2022

Hi @nidegen,

I added my repro with instructions here: https://github.com/ncooke3/repros/tree/main/firebase-8878/KeychainSharing

Would you mind confirming the behavior on a tvOS device?

@nidegen
Copy link
Author

nidegen commented Jan 22, 2022

Done on a real Apple TV 4k. Same behaviour unfortunately.

Screenshot 2022-01-22 at 20 39 20

@ncooke3
Copy link
Member

ncooke3 commented Jan 22, 2022

Thanks a lot @nidegen– I appreciate the help! I filed a radar with Apple on my end. Hopefully we can get an answer for the community about keychain sharing on tvOS. I'll keep this thread updated.

@nidegen
Copy link
Author

nidegen commented Jan 23, 2022

Great, did the same. Hope it will get fixed soon.

As a side note, while shared keychain is awesome I would be able to circumvent it if Phone Auth was available on tvOS too (macOS would be nice too). Would be great to see this happen too:)

@nidegen
Copy link
Author

nidegen commented Jan 27, 2022

Unfortunately, Apple updated the docs indicating tvOS is not supposed to sync over iCloud:( https://developer.apple.com/forums/thread/690714?answerId=702729022#702729022

@ncooke3
Copy link
Member

ncooke3 commented Jan 27, 2022

Thanks for the update! That is indeed unfortunate. Hopefully support is added in the future. 🤞

@firebase firebase locked and limited conversation to collaborators Feb 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants