login with apple using allauth and dj-rest-auth

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

I was running into the same issue but figured it out by printing the error in the file where the exception is being raised (jwtkit.py of the allauth package). Likely the jwt.decode function is failing, and raising the exception. For me the error let me know that the ‘audience’ did not match. After updating the ‘client_id’ to match the bundle identifier of my app, it worked for me.