ash_authentication icon indicating copy to clipboard operation
ash_authentication copied to clipboard

improvement: add apple strategy

Open miguel-s opened this issue 6 months ago • 6 comments

Improvement

Adds a new auth strategy for Sign in with Apple. Based on the Oidc strategy.

Many thanks to kurmetaubanov for laying the groundwork.

Discussion

Sign in with Apple is based on OpenID Connect but has a couple of unique things, because it's Apple.

Apple and Assent require a few new config fields:

  • team_id
  • private_key_id
  • private_key_path

To reuse as much of the implementation of the Oidc/Oauth2, I added these new fields where required:

  • lib/ash_authentication/strategies/oauth2.ex
  • lib/ash_authentication/strategies/oauth2/plug.ex
  • .formatter.exs

Not sure this is the right approach, as these fields are very Apple specific, wdyt?

Issues

  • When adding the confirmation add-on for the email field the confirmation email is sent on every signin/register. Not sure if this is an issue with just the Apple strategy or also affects other oauth strategies.

Todo

  • [x] Implementation
  • [ ] Tests
  • [ ] Documentation

miguel-s avatar Jul 24 '24 08:07 miguel-s