-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Auth for watchOS #4632
Conversation
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. |
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Firebase/Auth/Source/SystemService/FIRAuthNotificationManager.m
Outdated
Show resolved
Hide resolved
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data]; | ||
#else | ||
NSError *error; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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! |
I will finish it up. 👍 |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
Firebase/Auth/Source/SystemService/FIRAuthNotificationManager.m
Outdated
Show resolved
Hide resolved
#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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see: #4621 (comment)
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
Any headway with this PR? |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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).
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! |
No worries at all. I’ve been using my own fork meanwhile but I’d assume others would appreciate a quick merge. If you think you can do the required changes before the weekend please do so. I’m not able to look into it this week.
…
On Apr 23, 2020, at 10:41 PM, Ryan Wilson ***@***.***> wrote:
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!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Just to update here - tried to rebase on master but it ended up quite messy... will give it another go this week. |
I re-implemented your changes along with some other additions/modifications on 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! |
I made my email address visible in my profile. Hope it helps! |
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]>
* 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]>
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.