-
-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth2Session(client_id=client_id, client=client) return 403 error in production environment #232
Comments
OAuth2Session(client_id=client_id, client=client, token=token).get(URL) |
Are you sure your client id and token are valid for the production environment? |
Sure, I'm trying to use it for test my rest service. When I run it in localhost, it works good. In production, in virtual machine I obtain 403 error on my requests, the only difference is the environment. |
Does your use of the django test client actually do the OAuth dance? |
Yes. Btw in my rest service implement only the client credential flow |
So you're using the Are there any backend differences between you running against localhost and running in production? Can you find any reason for the 403 in the logs? |
Nothing in log, but my code
|
I'd be very interested to know whether the control flow through this function is the same in both your localhost and production instances. Are you going to be able to safely discover that on your production deployment? |
How could it be different? I'm running in debug mode even the production |
@ilGuccio The function is complex enough and depends enough on external factors that it could be different. I'd like to rule that possibility out first. When debugging, simply assuming that the code is functioning as you expect is not good enough. We must prove it. =) |
I'm truly confused, tryed to run the application on virtual machine via |
This is why I want you to trace the flow of execution: I don't think we know what's going on here. |
Solved, the problem was Apache configuration |
Aha, thanks for following up! ✨ |
OAuth2Session(client_id=client_id, client=client) return 403 error in production environment.
Works good in localhost
In localhost and production environment I disabled OAUTHLIB_INSECURE_TRANSPORT
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
The text was updated successfully, but these errors were encountered: