I’m working on an integration to get information out of our Docebo in Python, eventually into our DWS.
I have the API set up for: Authorization code + implicit grant, Resource owner password credentials, and Client credentials.
But when trying to run a request to get data via my client credential oauth2 session, I get a 401 error. When I run it against my password credential oauth2 session, it runs fine (200 code).
Any thoughts on why this may be happening or how I can rectify? I’d rather use client credentials for our M2M process.
password_oauth = OAuth2Session(client=LegacyApplicationClient(client_id=client_id))
password_token = password_oauth.fetch_token(token_url=token_url, username=username, password=password, client_id=client_id, client_secret=client_secret)
print(password_token)
password_user_list = password_oauth.get('https://sercu.docebosaas.com/manage/v1/user')
print(password_user_list.status_code)
client_auth = HTTPBasicAuth(client_id, client_secret)
client_client = BackendApplicationClient(client_id=client_id)
client_oauth = OAuth2Session(client=client_client)
client_token = client_oauth.fetch_token(token_url=token_url, auth=client_auth)
print(client_token)
backend_user_list = client_oauth.get('https://sercu.docebosaas.com/manage/v1/user')
print(backend_user_list.status_code)
Both instances create a token as expected, but only the first oauth session works.