Sitelet https://github.com/authomatic/authomatic/pull/231
Skip to content

Add Apple as a provider - #231

Open
erral wants to merge 8 commits into
authomatic:masterfrom
erral:login-with-apple
Open

erral wants to merge 8 commits into
authomatic:masterfrom
erral:login-with-apple

Conversation

@erral

@erral erral commented Feb 28, 2024 •

Copy link
Copy Markdown

I have been working on adding Apple as an authentication provider into Authomatic.

To do so I had to introduce 2 changes in the OAuth2 base class:

  • Add a method to get the secret for the access token request phase: Apple's OAuth2 implementation requires a specific secret to be sent in the access token request. This secret is a JWT token encoded with a secret that Apple provides when registering the client. That's why I introduce a method to get the credentials, which in base OAuth2 just returns the consumer secret, and in Apple returns the dedicated JWT token. To do so, I introduce PyJWT as a requirement of the package.
  • Add a method to get extra params that Apple requires in the access token phase: Apple requires to send the response_mode param, so I add a dummy method that returns nothing in the base OAuth2 class and then the method that returns what Apple requires in its own baseclass.

I don't exactly know whether Apple's implementation is a fully OAuth2 compliant implementation, so I am OK if this PR is completely disregarded. I just wanted to let you know about these changes and discuss them before integrating into Authomatic.

keys = json.loads(result).get("keys")

if not isinstance(keys, list) or not keys:
raise

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pylint does not like a bare raise here.

py3: commands[0]> pylint --errors-only --ignore=six.py authomatic
************* Module authomatic.providers.oauth2
authomatic/providers/oauth2.py:665:12: E0704: The raise statement is not inside an except clause (misplaced-bare-raise)
py3: exit 2 (5.21 seconds) /home/runner/work/authomatic/authomatic> pylint --errors-only --ignore=six.py authomatic pid=1762
  py3: FAIL code 2 (18.88=setup[13.67]+cmd[5.21] seconds)
  evaluation failed :( (19.00 seconds)

This branch has not been deployed

No deployments
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