firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

FR: Phone Auth for macOS and tvOS

Open nidegen opened this issue 4 years ago • 23 comments

Feature proposal

  • Firebase Component: Auth

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?

nidegen avatar Jun 10 '21 09:06 nidegen

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

ryanwilson avatar Jul 19 '21 13:07 ryanwilson

awesome! just signed up:)

nidegen avatar Jul 19 '21 13:07 nidegen

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:))

nidegen avatar Jul 19 '21 13:07 nidegen

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.

pradeep-spikey-tech avatar Jan 26 '22 04:01 pradeep-spikey-tech

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

nidegen avatar Feb 10 '22 09:02 nidegen

@ryanwilson Any hope this will be implemented soonish?

nidegen avatar Jun 13 '22 14:06 nidegen

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

cc @renkelvin for visibility

ryanwilson avatar Jun 14 '22 12:06 ryanwilson

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 avatar Jun 22 '22 09:06 nidegen

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? 🙃

nidegen avatar Aug 08 '22 11:08 nidegen

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.

ncooke3 avatar Aug 18 '22 01:08 ncooke3

@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

  • Push notification registration to receive background device verification
  • Web interface to present recaptcha in case the notifications do not work..

Am I missing anything?

nidegen avatar Aug 19 '22 07:08 nidegen

@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.

paulb777 avatar Aug 19 '22 18:08 paulb777

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.

renkelvin avatar Aug 19 '22 20:08 renkelvin

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

ghost avatar Sep 24 '22 12:09 ghost

@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:)

nidegen avatar Sep 24 '22 20:09 nidegen

Why not be of great help then?

ghost avatar Sep 24 '22 23:09 ghost

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.

ghost avatar Sep 24 '22 23:09 ghost

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

nidegen avatar Sep 25 '22 08:09 nidegen

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 

ghost avatar Sep 25 '22 14:09 ghost

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

nidegen avatar Sep 25 '22 18:09 nidegen

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.

paulb777 avatar Sep 26 '22 16:09 paulb777

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

nidegen avatar Sep 27 '22 10:09 nidegen

@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.

paulb777 avatar Sep 27 '22 22:09 paulb777