question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

access_token field added to request url when oauth2_access_token already present

See original GitHub issue

When trying to make a request for a LinkedIn resource I was recieving an unpermitted field error.

b’{“serviceErrorCode”:100,“message”:“Unpermitted fields present in PARAMETER: Data Processing Exception while processing fields [/access_token]”,“status”:403}

Manual review of the URL revealed 2 access token related fields:

  1. oauth2_access_token
  2. access_token

Looking at the OAuth2-Requests source code in requests-oauthlib/requests_oauthlib/oauth2_session.py, the access_token field is added to the url right before making the final request via the add_token() method.

I imagine there is a mechanism in place to prevent the behavior but I could not find it? My solution was to copy a modified version of the oauth2_session.py module into my project with this dirty fix inside the request() method.

old_version_url = url
url, headers, data = self._client.add_token(url, 
        http_method=method, body=data, headers=headers)
if "&access_token=" in url:
    url = old_version_url

Is there an official way to modify this behavior? Is this a bug? Please advise.

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tuseaucommented, Sep 13, 2019

It would be nice to have this fixed as it has completely broken the Linkedin integration.

0reactions
jtroussardcommented, Feb 17, 2020

This has been solved with PR #397

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add new field in Spring Boot Oauth2 response - Stack Overflow
I am crated a Spring Boot Oauth2 Authentication and worked fine. I need to add usertype field with Oauth2 response. My Code given...
Read more >
Issue with Oauth2 Access Token Request - Zapier Community
Two days back there was input field for entering the Access Token URL, which is now missing from the configuration page. It would...
Read more >
Access Token Response - OAuth 2.0 Simplified
If the request for an access token is valid, the authorization server needs to generate an access token (and optional refresh token) and...
Read more >
How to add custom fields in OAuth2 access token fr...
I am trying to reuse the OAuth2 token generation from the edge, but add custom fields into the generated token. I see plenty...
Read more >
OAuth2 Authorization Code Flow
Step 6: Add the Access Token to the Authorization Request; Step 7 (Optional): ... For example, the following shows an encoded URL authorization...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found