-
Notifications
You must be signed in to change notification settings - Fork 158
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
Changed state and email fields to optional to match Apple's responses #432
Changed state and email fields to optional to match Apple's responses #432
Conversation
@intonarumori Thanks for the thorough investigation. Surely I was always testing with a I will verify this locally and if it fixes the |
I think that is already working fine because the whole |
Just tested this on web without any requested Before (on master) it failed, and with this fix it worked fine. So thanks a ton @intonarumori! |
Yes, that would be a great follow-up. The code should not assume that it's only that specific error type. Will have to check whether an |
Heya, we ran into this as well at Superlist. I have upgraded to the master branch and found everything now works as expected. Just a heads up it'd be helpful to publish a new version of the sign_in_with_apple_web package as I'm sure other folks will run into this bug as well. Thanks for the package and consideration! |
@brian-superlist These changes were already released with 6.1.2: https://pub.dev/packages/sign_in_with_apple/changelog Maybe you were on 5.x.x before, and thus the switch to |
@tp Thanks for the heads up, but I don't think that is correct.. We were on 6.1.2, but these changes were not released with that version. This change affects the sign_in_with_apple_web plugin, not the sign_in_with_apple plugin. The web plugin was last updated 8 months ago and does not include these changes: https://pub.dev/packages/sign_in_with_apple_web/versions Therefore, in our pubspec, I manually override only the sign_in_with_apple_web plugin to point to master. That's the package that I'd recommend deploying a new version of |
to properly include #432 which was supposed to go out in 6.1.2
@brian-superlist You are right 🙈 I missed the need to publish and update the reference to This has now been fixed and the latest https://pub.dev/packages/sign_in_with_apple/versions/6.1.4 now pulls in a fresh release of the web part. Thanks for bringing this up :) |
In this PR we updated the model objects to match Apple's responses.
The Issue
We were getting errors with the library if we omitted the state parameter in our call to
getIDCredential
or we were hiding our email address in the Apple Sign-in dialog. The error was pretty obscure:What was actually happening
state
parameter when callinggetIDCredential
and then hid the email in the Apple Sign-in dialogstate
andemail
fields were omitted in the JS response from AppletoDart
here could not parse the JS object because thestate
andemail
fields were defined as required fields and not optionals inUserI
andAuthorizationI
SignInErrorI
hereThe solution
state
field has been updated to be optional:state
is defined as optional when callinggetIDCredential
here. When not passing it, Apple will omit it in their response, thus it should be an optional field onAuthorizationI
.email
field has been updated to optional: In various circumstances (ex. when the user uses Apple sign-in with their email hidden) this field might be omitted in the response from Apple. Thus this should also be defined as optional inUserI
.Couple of questions remain
name.firstName
andname.lastName
?So far we were not about to clear any of these fields so it seems they are always provided, however it's hard to know we really covered all edge cases.