firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.65k stars 1.48k forks source link

FR: Phone Auth for macOS and tvOS #8221

Open nidegen opened 3 years ago

nidegen commented 3 years ago

Feature proposal

I think it's pretty clear: I want to be able to sign in to tvOS and macOS using the phone number:)

Alternatively, I was wondering about shared keychain auth. Could this work between iOS and tvOS?

ryanwilson commented 3 years ago

Thanks for pinging this issue in the other thread - we're working on improvements to support tvOS and macOS in a better capacity and it would be gret to get your feedback.

If you're interested in chatting with us and getting early access to future updates, please sign up using this form : https://forms.gle/odseGnshb3Jq8wuz5

nidegen commented 3 years ago

awesome! just signed up:)

nidegen commented 3 years ago

Frankly, it would be enough if iCloud keychain auth sharing works, but I haven't been able to test it yet (need to get it working on iOS first:))

pradeep-spikey-tech commented 2 years ago

Hi, I'm looking for the same, to be able to log in to macOS and tvOS apps using Phone Authentication. Hope it'll be released soon for general usage.

nidegen commented 2 years ago

Given that #8878 is not solvable, phone auth for tvOS would be important for me:)

nidegen commented 2 years ago

@ryanwilson Any hope this will be implemented soonish?

ryanwilson commented 2 years ago

Hey @nidegen - unfortunately I don't have any timelines to share.

cc @renkelvin for visibility

nidegen commented 2 years ago

No worries. Do you know if it is technically possible on macOS? I know that on tvOS, both recaptcha and push notifications are unavailable, which makes it impossible to fix just front-end wise.

But on macOS both is available in theory, so it should be possible just with SDK fixes. If so, I can have a try adding macOS support. Is that correct or am I missing something?

nidegen commented 2 years ago

No worries. Do you know if it is technically possible on macOS? I know that on tvOS, both recaptcha and push notifications are unavailable, which makes it impossible to fix just front-end wise.

But on macOS both is available in theory, so it should be possible just with SDK fixes. If so, I can have a try adding macOS support. Is that correct or am I missing something?

Any comments @renkelvin maybe? 🙃

ncooke3 commented 2 years ago

Hi @nidegen, sorry for the delay here. I spoke with renkelvin@ and while you are correct that this should be possible with an SDK change, this feature is not on the near-term roadmap. That being said, we are very much open to contributions and would be happy to help advise you if you chose to work on this.

nidegen commented 2 years ago

@ncooke3 Cool! Any chance firebase would support a pure Swift PhoneAuth extension? Or do you think it would be easiest to just hack some #if macOS into the existing code?

As I see it, what is preventing macOS to work currently is the lack of

Am I missing anything?

paulb777 commented 2 years ago

@nidegen Yes, we would support a pure Swift FirebaseAuthSwift library extension, similar to what we have for some of the other Firebase products. We can manage the SPM or CocoaPods wiring if you only want to do one.

I'll defer to others for the other questions.

renkelvin commented 2 years ago

HI @nidegen , thanks for helping with this! I think we can start with hacking #if macOS in the existing code.

Your understanding is correct. Just note that the recaptcha flow is reused in the MFA flow, so we want to make sure it doesn't break the existing MFA flows.

ghost commented 2 years ago

My team and several others I know would implement this in a heartbeat.

nidegen commented 2 years ago

@samkulkarni3 Cool! I have started to work on it at https://github.com/nidegen/firebase-ios-sdk/tree/phone-mac, but not sure if this is of great help:)

ghost commented 2 years ago

Why not be of great help then?

ghost commented 2 years ago

Just off studying Firebase-iOS-SDK for a few hours, you can determine that it should most likely be a compatibility framework, which runs on SwiftUI... as that has been the trend for most new, Multiplatform work firebase has done lately. Call it Firebase-PlatformCompatibility, for example.

This would be high quality enough for Firebase to truly implement your work into their main branch, and it would increase your reputation as a developer.

Be helpful.

Here are some resources to help you:

https://github.com/SwiftUIX/SwiftUIX https://github.com/devicekit/DeviceKit

https://github.com/MontanaFlossCo/Flint > https://github.com/MontanaFlossCo/Flint/tree/master/FlintCore/Constraints/Platforms

I am willing to start a framework with you on this.

nidegen commented 2 years ago

Not sure if we are on the same page here. This issue is about adding the macOS support to the Firebase SDK..

ghost commented 2 years ago

Yes. And based on your singular commit - which they have not acknowledged yet and this issue being ignored for over a year and three months now, it is clear your singular commit is not sufficient.

I am suggesting you go about this a different way. It's not clean code to place if statements every where in a codebase, either.

When creating a framework to be used for multiple platforms you should use a typealias or capture the platform as an object which is initialized and applied throughout the project.

e.g. -

#if os(macOS)
#if canImport(AppKit)
import AppKit
#endif 

public typealias xApplication = NSApplication
public typealias xApplicationDelegate = NSApplicationDelegate

#endif 

and....

#if os(iOS) || os(macOS) || os(tvOS) || targetEnvironment(macCatalyst)

#if canImport(UIKit)
import UIKit 
#endif 

public typealias xApplication = UIApplication
public typealias xApplicationDelegate = UIApplicationDelegate

#endif 
nidegen commented 2 years ago

Sure, I know that. Feel free to use my branch as a starting point, or ask me for comments on your branch!

paulb777 commented 2 years ago

Given the current state of the code with the existing iOS implementation, an incremental #if approach to add macOS and tvOS is likely the most expedient approach.

Longer term, we'd like to do a Swift reimplementation.

nidegen commented 2 years ago

Perfect. I was actually only thinking of macOS in a first step, as I assumed tvOS wouldn't work as it has neither push notifications nor web views available (needed for app check I believe). Is that wrong, i.e. could tvOS still be made to work somehow? @paulb777

paulb777 commented 2 years ago

@nidegen I wasn't thinking any deeper than the title of the FR in the above statement. I believe your analysis about tvOS is correct.