hello I am having this issues.
settings
APPLE_CLIENT_SECRET = config("APPLE_CLIENT_SECRET")
APPLE_CLIENT_ID = config("APPLE_CLIENT_ID")
APPLE_KEY = config("APPLE_KEY")
APPLE_CERTIFICATE_KEY = config("APPLE_CERTIFICATE_KEY")
APPLE_CALLBACK_URL = config("APPLE_CALLBACK_URL")
SOCIALACCOUNT_PROVIDERS = {
'apple': {
"APP": {
"client_id": APPLE_CLIENT_ID,
"secret": APPLE_CLIENT_SECRET,
"key": APPLE_KEY,
"certificate_key": APPLE_CERTIFICATE_KEY
},
'SCOPE': ['profile', 'email'],
'AUTH_PARAMS': {'access_type': 'online'}
}
}
views.py
from allauth.socialaccount.providers.apple.client import AppleOAuth2Client
from allauth.socialaccount.providers.apple.views import AppleOAuth2Adapter
from dj_rest_auth.registration.views import SocialLoginView
class AppleLogin(SocialLoginView):
adapter_class = AppleOAuth2Adapter
callback_url = settings.APPLE_CALLBACK_URL
# client_class = OAuth2Client
client_class = AppleOAuth2Client
def post(self, request, *args, **kwargs):
try:
return super().post(request, *args, **kwargs)
except OAuth2Error as e:
# Handle the OAuth2Error here
error_message = str(e)
return Response({"error": error_message}, status=status.HTTP_400_BAD_REQUEST)
urls.py
path('apple/', AppleLogin.as_view(), name='apple-login'),
curl -X POST 'https://.../auth/apple/' \
-d 'id_token=ID_TOKEN' \
-d 'access_token=AUTHENTICATION_CODE'
i get this repsonse
{
"error": "Invalid id_token"
}
need help with this. I am using
django-allauth==0.50.0
dj-rest-auth==4.0.1