requests-oauth2 | Python 's Requests OAuth2 plugin | OAuth library
kandi X-RAY | requests-oauth2 Summary
kandi X-RAY | requests-oauth2 Summary
Python's Requests OAuth2 (Open Authentication) plugin
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handle Google OAuth 2
- Generate the authorization URL
- Get a token
- Make a HTTP POST request
- Check if attributes are configured
- Refresh access token
- Revoke a token
requests-oauth2 Key Features
requests-oauth2 Examples and Code Snippets
Community Discussions
Trending Discussions on requests-oauth2
QUESTION
I'm trying to run the requests-OAuth2 LinkedIn example. I've been able to fix a few issues with the example being out of date but cannot seem to get the last line to run correctly.
The response object contents from running the program:
The System and Versionsb'{"serviceErrorCode":100,"message":"Unpermitted fields present in PARAMETER: Data Processing Exception while processing fields [/access_token]","status":403}
- Python 3.6.8
- requests 2.22.0
- requests-oauthlib 1.2.0
Running everything through terminal.
- First of all the application settings have the correct permissions
r_liteprofile
. - I confirmed that I am authenticating with with correct scope.
- I've tried adding various headers to the get request.
- I console printed the contents of the PARAMETERS variable in the request object and found it to be an empty dict.
I've added comments to explain which changes I've made from the stock tutorial on the requests-oauthlib website.
...ANSWER
Answered 2020-Feb-17 at 21:11As per the documentation and comments made on the github repository, https://github.com/requests/requests-oauthlib LinkedIn compliance fixes were outdated and causing bugs. The maintainers have since removed the LinkedIn compliance fix code and applied several updates to the LinkedIn example as part of PR #397. This should not be an issue anymore.
Original Answer BelowUltimately the request url I was passing contained an unpermitted field. Manual review of the url revealed two fields:
oauth2_access_token
access_token
Looking at the OAuth2-Requests source code, the second field is added to the url right before making the final request.
requests-oauthlib/requests_oauthlib/oauth2_session.py
I imagine there is a mechanism in place to prevent the behavior but I could not find it and my comments/questions on their github and other places went unanswered. My solution was to copy a modified version of the oauth2_session.py
module in my project with this dirty fix within the request()
method.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install requests-oauth2
You can use requests-oauth2 like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page