Skip to content

Sign In With Apple - Name is not available in the ClaimsIdentity#2442

Closed
anarian wants to merge 1 commit intoopeniddict:devfrom
myblueprint-spaces:bugfix/apple-name
Closed

Sign In With Apple - Name is not available in the ClaimsIdentity#2442
anarian wants to merge 1 commit intoopeniddict:devfrom
myblueprint-spaces:bugfix/apple-name

Conversation

@anarian
Copy link
Contributor

@anarian anarian commented Mar 10, 2026

Sign In With Apple provides the name as JSON object. They only provide this on the first sign up with to the app, afterwards they stop providing this unless you delete the app from your iOS settings or Apple account settings.

image

I wasn't able to test this using the sandbox console client, Sign In With Apple requires HTTPS return URLs, I'm not able to specify a localhost URL. I'm also having trouble building the binaries locally to run with my web application.

image

Similar to my last PR for Clever, I added the remapping here to handle this. I also added "name" to the Scopes constant since this was hardcoded as a string in OverrideResponseMode, and required with OpenIddictClientWebIntegrationBuilder.Apple.AddScopes for Apple to provide the user's name.

@kevinchalet
Copy link
Member

kevinchalet commented Mar 10, 2026

Thanks for your PR.

Not extracting the user node from the authorization response was actually a deliberate design choice when I added the provider back in March 2022: this non-standard node is not authenticated and can be easily manipulated by a malicious user to inject any arbitrary name or email address. If an app relies on the email address to make any security-related decision, there's a huge potential for abuse (typically, an elevation of privilege). See aspnet-contrib/AspNet.Security.OAuth.Providers#713 for additional information.

// Note: Apple returns a non-standard "name" claim formatted as a JSON object.
else if (context.Registration.ProviderType is ProviderTypes.Apple)
{
var name = context.Response[Claims.Name];
Copy link
Member

Choose a reason for hiding this comment

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

Hum, I don't think it does what you want: this handler exclusively deals with parameters present in the userinfo response, not the authorization response. Unless Apple has decided to fix their horrible implementation, the user node is part of the authorization response, not the userinfo response.

@kevinchalet
Copy link
Member

I wasn't able to test this using the sandbox console client, Sign In With Apple requires HTTPS return URLs, I'm not able to specify a localhost URL.

To work around this stupid limitation, you can use ngrok or Microsoft's Dev Tunnels.

I'm also having trouble building the binaries locally to run with my web application.

Are you seeing any particular error message?

@anarian anarian marked this pull request as draft March 10, 2026 20:41
@anarian
Copy link
Contributor Author

anarian commented Mar 11, 2026

Thanks for having a look at this. Apple is still using the non-standard node for the information, so I decided to use two custom event handlers to handle this instead.

If you're interested in having a look, I'll push the changes to my remote branch and leave that solution there if anyone else encounters this error in the future.

@anarian anarian closed this Mar 11, 2026
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.

2 participants