OAuth2 (With Python)

I am trying to get an OAuth2 token with python. I am using the foloowing code:

payload = {
    "grant_type": "authorization_code",
    "client_id": CLIENT_ID,
    "client_secret": CLIENT_SECRET,
    "code": code,
    "redirect_uri": redirect_uri,
r = requests.post("https://www.openstreetmap.org/oauth2/token", data=payload)

(Where code is returned from the first auth part.)

Instead of the token I keep getting HTTP 401 responses with:

{"error":"invalid_client","error_description":"Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."}

Any help would be appreciated!

Thank you!

3 posts - 2 participants

Read full topic

Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/oauth2-with-python/99532