dsimond
dsimond

Reputation: 113

django allauth and PKCE

I have to get login credentials from a 3rd service which require a PKCE to authenticate. I was thinking to use django-allauth to do it but I can't find a way to send the pkce in my request. There is nothing fancy in the way I'm doing it.

I generate a PKCE but where can I add it in the allauth request ?

The configuration is quite simple atm, I did a custom SOCIALACCOUNT_PROVIDERS in my settings.py. It contact the server but the PKCE ( code_challenge ) is missing.

SOCIALACCOUNT_PROVIDERS = {
    "auth0": {
        "AUTH0_URL": provider,
        "APP": {
            "client_id": client_id,
            "secret": secret
            "key": "",
            "code_challenge": code_challenge
        }
    }
}

Any idea ? Thanks

Upvotes: 0

Views: 580

Answers (2)

ytyng
ytyng

Reputation: 715

You can use OAUTH_PKCE_ENABLED key.

e.g.:

SOCIALACCOUNT_PROVIDERS = {
    "auth0": {
        "AUTH0_URL": provider,
        "OAUTH_PKCE_ENABLED": True,  # add this
        "APP": {
            "client_id": client_id,
            "secret": secret
            "key": "",
        }
    }
}

See also: Auth0 - django-allauth

Upvotes: 0

Adam P
Adam P

Reputation: 382

Try adding AUTH_PARAMS

SOCIALACCOUNT_PROVIDERS = {
    "auth0": {
        "AUTH0_URL": provider,
        "APP": {
            "client_id": client_id,
            "secret": secret
            "key": "",
        },
       'AUTH_PARAMS': {
            'code_challenge_method': 'S256',
            'code_challenge': '362t6atUC1Fz'
        }
    }
}

Upvotes: 0

Related Questions