I followed the examples here, and created a working script that successfully authenticates with Oauth2 and pulls data from a web API. However, when this code runs in a celery task as part of a Django app it fails with a invalid_client
error. The code snipit follows.
app_client = BackendApplicationClient(client_id=config.CLIENT_ID)
headers = {
"Host": "api.sitescout.com",
"Authorization": config.AUTHORIZATION_HEADER,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
}
token_params = {"grant_type": "client_credentials"}
client = OAuth2Session(client_id=config.CLIENT_ID, client=app_client)
Is there something I should be doing differently to set up the connection from withing a running web application?