-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Description
I've been trying to implement sign in with apple following this article and instructions from the docs, but still struggling.
I have set up everything from the docs, but whenever I make a request to convert_token view, I always end up with the following Exception:
#...
File "/myproject/.venv/lib/python3.8/site-packages/rest_framework/views.py" in dispatch
502. response = handler(request, *args, **kwargs)
File "/myproject/.venv/lib/python3.8/site-packages/rest_framework_social_oauth2/views.py" in post
70. url, headers, body, status = self.create_token_response(request._request)
File "/myproject/.venv/lib/python3.8/site-packages/oauth2_provider/views/mixins.py" in create_token_response
128. return core.create_token_response(request)
File "/myproject/.venv/lib/python3.8/site-packages/oauth2_provider/oauth2_backends.py" in create_token_response
145. headers, body, status = self.server.create_token_response(
File "/myproject/.venv/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/endpoints/base.py" in wrapper
116. return f(endpoint, uri, *args, **kwargs)
File "/myproject/.venv/lib/python3.8/site-packages/rest_framework_social_oauth2/oauth2_endpoints.py" in create_token_response
59. return grant_type_handler.create_token_response(
File "/myproject/.venv/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py" in create_token_response
60. self.validate_token_request(request)
File "/myproject/.venv/lib/python3.8/site-packages/rest_framework_social_oauth2/oauth2_grants.py" in validate_token_request
94. user = backend.do_auth(access_token=request.token)
File "/myproject/.venv/lib/python3.8/site-packages/social_core/utils.py" in wrapper
248. return func(*args, **kwargs)
File "/myproject/.venv/lib/python3.8/site-packages/social_core/backends/oauth.py" in do_auth
403. return self.strategy.authenticate(*args, **kwargs)
File "/myproject/.venv/lib/python3.8/site-packages/social_django/strategy.py" in authenticate
107. return authenticate(*args, **kwargs)
File "/myproject/.venv/lib/python3.8/site-packages/django/contrib/auth/__init__.py" in authenticate
73. user = backend.authenticate(request, **credentials)
File "/myproject/.venv/lib/python3.8/site-packages/social_core/backends/base.py" in authenticate
80. return self.pipeline(pipeline, *args, **kwargs)
File "/myproject/.venv/lib/python3.8/site-packages/social_core/backends/base.py" in pipeline
83. out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs)
File "/myproject/.venv/lib/python3.8/site-packages/social_core/backends/base.py" in run_pipeline
113. result = func(*args, **out) or {}
File "/myproject/.venv/lib/python3.8/site-packages/social_core/pipeline/social_auth.py" in social_details
5. return {'details': dict(backend.get_user_details(response), **details)}
File "/myproject/.venv/lib/python3.8/site-packages/social_core/backends/base.py" in get_user_details
173. raise NotImplementedError('Implement in subclass')
Exception Type: NotImplementedError at /web/hook/apple-sign-in/
Exception Value: Implement in subclass
It's weird - it seems like the BaseAuth tries to authenticate the user instead of AppleIdAuth, but my settings seem to be correct in this regard.
In my settings.py:
AUTHENTICATION_BACKENDS = [
'rest_framework_social_oauth2.backends.DjangoOAuth2',
'django.contrib.auth.backends.ModelBackend'
]
SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
'social_core.backends.apple.AppleIdAuth',
)
REST_FRAMEWORK = {
# ...
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
'rest_framework_social_oauth2.authentication.SocialAuthentication',
),
}
Example payload I am trying to send to convert_token:
{
"grant_type": "convert_token",
"client_id": "~someid",
"client_secret": "~someappsecret",
"backend": "apple-id",
"token": "~sometokenfromapple",
}
Am I missing something? Please advise.
Metadata
Metadata
Assignees
Labels
No labels