Skip to content

PR: Auth for watchOS #4632

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

Closed
wants to merge 9 commits into from
Closed

PR: Auth for watchOS #4632

wants to merge 9 commits into from

Conversation

hohteri
Copy link
Contributor

@hohteri hohteri commented Jan 8, 2020

PR for FR #4621

Tested with email & password, Apple ID and email link sign ins. Please note that both Apple ID and email link sign in work only on a real device.

Please see FR for further discussion and sample code for using email link sign in.

@renkelvin
Copy link
Contributor

Thanks @hohteri for you contribution! We'll review and get back to you. Since it's a non-trivial change, we may need more time on the watchOS support.

Copy link
Member

@ryanwilson ryanwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the long delay, and thank you so much for the contribution - this is great! A few comments but most of them are small. I'll work with you through getting this up and running.

@@ -78,6 +79,9 @@ + (void)getCredentialWithCompletion:(FIRGameCenterCredentialCallback)completion
timestamp:timestamp
displayName:displayName];
completion(credential, nil);
#else
completion(nil, nil);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is purely because this PR doesn't support game center, right?

If that's the case, can you please construct an error and return it in the completion block? A helper method to generate the error can go at the bottom of this header: https://github.com/firebase/firebase-ios-sdk/blob/master/Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.h

and the implementation in the associated .m file.

For the error code itself, please use FIRAuthErrorCodeInternalError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apple has deprecated playerID property on watchOS 6 and the suggested replacement teamPlayerID is not available on watchOS.

NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
#else
NSError *error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what sort of errors are potentially expected here, and where we should be checking it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should refactor it to using GULSecureCoding eventually (may be a part of a follow up PR). No existing data migration will be required because the archive file format is the same for the secure coding.

Copy link
Contributor Author

@hohteri hohteri Feb 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do anything to this. According to the documentation:

This method throws an error if data isn’t a valid keyed archive.

while the deprecated method throws an exception if data is not a valid archive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG - @maksymmalyhin we can refactor after the fact since it's not directly related to watchOS.

@ryanwilson
Copy link
Member

Hey @hohteri - let me know if you wanted to continue on with this or someone on our side should finish it up! No rush 😄 thanks!

@hohteri
Copy link
Contributor Author

hohteri commented Feb 10, 2020

I will finish it up. 👍

@hohteri hohteri requested a review from ryanwilson February 10, 2020 19:42
Copy link
Member

@ryanwilson ryanwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more things! Thanks again

NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
#else
NSError *error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG - @maksymmalyhin we can refactor after the fact since it's not directly related to watchOS.

#if TARGET_OS_WATCH
/*
The sign in can't happen fully in-app, i.e. watchOS does not support universal links but watchOS has a mail client that will open this link appropriately
in a browser. From the browser you trigger a cloud function which sends a push notification to complete the sign-in.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that something manual that you set up, or are you saying that's how it'll work automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see: #4621 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renkelvin can you please take a look at this bit specifically?

I'm comfortable merging the email/password sign in changes now, I'm not sure about the email link and will defer to @renkelvin for Auth's view of this (see the comment for the full solution and context).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Maybe add a link to #4621 (comment) to make it easier to other developers?

@hohteri hohteri requested a review from ryanwilson February 18, 2020 07:13
@jostster
Copy link
Contributor

jostster commented Mar 5, 2020

Any headway with this PR?

Copy link
Member

@ryanwilson ryanwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So sorry for the delay - thanks for your patience on this one. LGTM and just want the Auth team to look at the email link sign in specifically since it's not just a simple SDK change.

#if TARGET_OS_WATCH
/*
The sign in can't happen fully in-app, i.e. watchOS does not support universal links but watchOS has a mail client that will open this link appropriately
in a browser. From the browser you trigger a cloud function which sends a push notification to complete the sign-in.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renkelvin can you please take a look at this bit specifically?

I'm comfortable merging the email/password sign in changes now, I'm not sure about the email link and will defer to @renkelvin for Auth's view of this (see the comment for the full solution and context).

@ryanwilson
Copy link
Member

Hey @hohteri - hope you're doing well and sorry for the big delay again.

The Auth directory was restructured so this will need a manual merge. If you'd like to do it, please do and we can get this merged as soon as possible afterwards. If you're not willing/able to (no worries at all if that's the case, you've done a lot so far!) then we're more than happy to continue it, keeping your existing commits and fixing the conflicts ourselves.

The one thing I think should be left out for the time being is the email sign in since it requires a cloud function. I'd prefer we evaluate this separately and come up with a more official suggestion for folks if that's okay with you!

Let us know how you'd like to continue with this and I'll try my best to get this looked at quicker :) thanks again!

@hohteri
Copy link
Contributor Author

hohteri commented Apr 23, 2020 via email

@ryanwilson
Copy link
Member

Just to update here - tried to rebase on master but it ended up quite messy... will give it another go this week.

@ryanwilson
Copy link
Member

I re-implemented your changes along with some other additions/modifications on master in #5585 - I still need to test it and make sure CI tests are happy

I added you as a co-author on the commit to make sure you got credit but for whatever reason it's not picking up your username. Is there a different email set up with your GitHub account that will help it link? I want to make sure you get credit for it!

@hohteri
Copy link
Contributor Author

hohteri commented May 13, 2020

I made my email address visible in my profile. Hope it helps!

@ryanwilson
Copy link
Member

I made my email address visible in my profile. Hope it helps!

That worked, thank you!
Co-authored commit

ryanwilson added a commit that referenced this pull request Aug 12, 2020
This is a redo of #5585, which was a re-implementation of #4632. This
ignores any changes to GoogleUtilities, those will be done in a later
PR to create a common KeyedArchiver utility.

Co-authored-by: Harri Hohteri <[email protected]>
@ryanwilson
Copy link
Member

Closing in favour of the more up to date #6260, where @hohteri is marked as a co-author.

@ryanwilson ryanwilson closed this Aug 12, 2020
ryanwilson added a commit that referenced this pull request Aug 12, 2020
* watchOS support for FirebaseAuth.

This is a redo of #5585, which was a re-implementation of #4632. This
ignores any changes to GoogleUtilities, those will be done in a later
PR to create a common KeyedArchiver utility.

Co-authored-by: Harri Hohteri <[email protected]>

* Fixed lint errors, added GHA tests.

* Enabled GHA for PRs as well.

Co-authored-by: Harri Hohteri <[email protected]>
@firebase firebase locked and limited conversation to collaborators Sep 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants