-
Notifications
You must be signed in to change notification settings - Fork 542
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
User object not returned after Apple Authorize #765
Comments
That’s correct in that the library does not use this information since 6.0.10. It’s also correct that there is exactly one opportunity to get these values from Apple. The use of the If you still want to access the raw payload, you can use the ticket creation event to do so. As the values can be spoofed as noted in the advisory, you should not use the data to make security-related decisions (e.g. authorisation checks). |
Thanks for the super quick response Martin, and the info. Much appreciated. I'll look into using the ticket creation event as you've suggested 🙇♂️ |
Hey Martin, a followup when you have a mo. I may have misunderstood when you said
By raw payload did you mean the payload that was passed from apple in the request form? Looking into using that ticket creation event I noticed that the value coming through for the I had created a draft PR Just to show that a change would be needed to surface that user object on the context in the event. But just for clarity - Is surfacing the |
Sorry - I confused the However, the AspNet.Security.OAuth.Providers/src/AspNet.Security.OAuth.Apple/AppleAuthenticationHandler.cs Lines 159 to 173 in f8e1386
You could use similar logic in your event handler to grab the |
@martincostello thank you so much for your help on this! You are a god send :) I'd been looking at this so long I totally missed the HTTP Context was available in the event handler 🤦 Problem solved! |
Describe the bug
Hi. I’m trying to retrieve the givenname and surname claims from the apple signin flow. My understanding is that this is only returned the very first time a user authenticates, and is returned in the same payload as the id_token, and would like something like this:
I’ve been diving around trying to work out why I can’t surface them in my Identity Server External Identity /callback endpoint and I wanted to check that the issue wasn’t in this Apple OAuth library.
I can see that as of 6.10.0 that the email is no longer taken from the User payload coming back from the apple authorise response, but also it seems that the user payload is somewhat discarded. I can see here:
AspNet.Security.OAuth.Providers/src/AspNet.Security.OAuth.Apple/AppleAuthenticationHandler.cs
Line 104 in 875fb02
That the User object is not included in the created ticket at all and doesn't appear to be available anywhere else. Could this be an oversight?
When creating the AuthenticationTicket, this User isn’t provided at all:
AspNet.Security.OAuth.Providers/src/AspNet.Security.OAuth.Apple/AppleAuthenticationHandler.cs
Line 108 in 875fb02
Could it be that these could be included in the
context.Properties
to be included in the AuthenticationTicket?Side note, I notice that the entire root payload is passed into the OAuthCreatingTIcketContext, should it be this instead:
tokens.Response.RootElement.GetString("user")
To return the user json object? As is expected by the OAuthCreaingTicketContext from the Owin repo:
https://github.com/pruiz/Owin.OAuthGeneric/blob/d1acc2983fd9624f3da576aaaf759ca615b1405d/Owin.OAuthGeneric/OAuthCreatingTicketContext.cs#L47
Steps To reproduce
Using Identity Server (Duende) logging in with Apple, the payload returned to the callback endpoint does not include any names (givenname or surname). It does not appear to be surfaced anywhere.
Expected behaviour
One first login, that in the callback endpoint we will have access to the User payload returned by apple's Authorize endpoint on first login.
Actual behaviour
None of this comes back to the Identity Server endpoint/
System information
dotnet 7
Duende Identity Server
Latest version of the apple oauth package
Additional context
For privacy reasons Apple does not provide an endpoint to retrieve users names after the initial login. The only opportunity to capture this information is on first sign in, so we need to ensure this is returned to the callback endpoint.
The text was updated successfully, but these errors were encountered: