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

Improve token construction logic and change key getter to public #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bradjones1
Copy link

Thanks for this package; Apple is pretty frustrating in that they kinda look like OAuth but their implementation is, well, wacky!

I am in a situation where I am doing both native app sign-in with Apple (because it's required...) as well as supporting sign-in with Apple on the web. Because their implementation looks like OpenID Connect but they don't support a user info endpoint, I'm passing the web back-end the ID token (a JWS) and using that to extract out the user's identity. This is done via a token exchange grant.

Anyway, I needed a way to construct an access token object using the ID token, and found that 1) the docblock on the constructor didn't reflect the true data requirements of the method and 2) it would be helpful to be able to fetch the Apple JWK set outside of the provider.

This PR addresses both points, which I think help make this package more syntactically correct and useful.

Admittedly this is a bit of a drive-by contribution but if this looks good in spirit, I can make whatever adjustments you'd like, e.g. test coverage. I'm not quite sure this requires new coverage?

@patrickbussmann
Copy link
Owner

Thanks for your pull request @bradjones1.
I allowed the actions to run but all tests are failing right now.
Can you adjust them please?
Thank you.

@bradjones1
Copy link
Author

I still intend to loop around on this, just busy building the project that this is used in 😂

Came back here to note that phpstan failed here b/c the param annotation expects Key[], but that is too strict.

Parameter #1 $keys of class League\OAuth2\Client\Token\AppleAccessToken constructor expects array<Firebase\JWT\Key>, array<string> given.

@patrickbussmann patrickbussmann force-pushed the main branch 14 times, most recently from 6e9831d to 6b38a21 Compare May 17, 2024 22:35
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