Skip to content
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

fix: Get user first name and last name from Apple #2331

Merged
merged 7 commits into from
Apr 21, 2022

Conversation

JiggyDown
Copy link
Contributor

@JiggyDown JiggyDown commented Mar 22, 2022

Currently we can't get user first name and last name from Apple as the names directly to the callback URL, as opposed to embedding them in the ID token like other OIDC providers. This PR makes sure we handle that behavior properly.

Related issue(s)

N/A

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security. vulnerability, I
    confirm that I got green light (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

This PR requires an E2E test, but I can't find an existing one for OIDC. Can you give me some pointers on how the test should be done?

@CLAassistant
Copy link

CLAassistant commented Mar 22, 2022

CLA assistant check
All committers have signed the CLA.

@JiggyDown JiggyDown changed the title Get user first name and last name from Apple fix: Get user first name and last name from Apple Mar 22, 2022
@codecov
Copy link

codecov bot commented Mar 22, 2022

Codecov Report

Merging #2331 (ae8dd8d) into master (a42a0f7) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

❗ Current head ae8dd8d differs from pull request most recent head bba2a3b. Consider uploading reports for the commit bba2a3b to get more accurate results

@@            Coverage Diff             @@
##           master    #2331      +/-   ##
==========================================
- Coverage   76.62%   76.61%   -0.01%     
==========================================
  Files         315      315              
  Lines       17358    17379      +21     
==========================================
+ Hits        13300    13315      +15     
- Misses       3122     3128       +6     
  Partials      936      936              
Impacted Files Coverage Δ
selfservice/strategy/oidc/provider_discord.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_facebook.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_github.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_github_app.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_microsoft.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_slack.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_spotify.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_vk.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_yandex.go 0.00% <0.00%> (ø)
selfservice/strategy/oidc/provider_apple.go 21.12% <60.00%> (+21.12%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f87bca...bba2a3b. Read the comment docs.

Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Thank you, this looks great! Since this is very difficult to test, could you please create a short screencast of this feature working and post it here?

Also can you confirm that https://www.ory.sh/docs/kratos/guides/sign-in-with-github-google-facebook-linkedin#apple is correct? There were a few people who had issues setting up Apple / cc @vinckr

Comment on lines 114 to 116
// https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/configuring_your_webpage_for_sign_in_with_apple#3331292
// First name and last name are passed only once in an additional parameter to the redirect URL.
// There's no way to make sure they haven't been tampered with. Blame Apple.
Copy link
Member

Choose a reason for hiding this comment

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

lol what

LastName *string `json:"lastName"`
} `json:"name"`
}
if err := json.Unmarshal([]byte(query.Get("user")), &user); err == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add a test for this?

Copy link
Member

Choose a reason for hiding this comment

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

@JiggyDown if you could add a small test for this, we can merge this right away :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test added. Thank you for your patience!

@aeneasr aeneasr self-assigned this Mar 28, 2022
@aeneasr
Copy link
Member

aeneasr commented Apr 11, 2022

@JiggyDown would you be open to make the requested changes?

@JiggyDown
Copy link
Contributor Author

Hey @aeneasr, sorry I didn't have time to revisit this PR. I'll try to finish it by the end of this week.

@JiggyDown JiggyDown requested a review from aeneasr April 18, 2022 16:17
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Awesome, thank you for making Ory better!

@aeneasr aeneasr merged commit 4779909 into ory:master Apr 21, 2022
@vinckr
Copy link
Member

vinckr commented Apr 22, 2022

Hello @JiggyDown
Congrats on merging your first PR in Ory 🎉 !
Your contribution will soon be helping secure millions of identities around the globe 🌏.
As a small token of appreciation we send all our first time contributors a gift package to welcome them to the community.
Please drop me an email and I will forward you the form to claim your Ory swag!

peturgeorgievv pushed a commit to senteca/kratos-fork that referenced this pull request Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants