Skip to content
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

Don't modify instance attributes when calling make_client with a token #177

Merged
merged 1 commit into from Jan 30, 2015

Conversation

@alejandrodob
Copy link
Contributor

commented Jan 30, 2015

When creating an OAuthRemoteApp object with a specific dict of "request_token_params", and afterwards calling make_client() with a specific token as an argument (for instance when calling any of the REST methods which in turn call request()), then "request_token_params" will be added the "resource_owner_key" and "resource_owner_secret" keys and values retrieved from the token passed.

Thus, if you want to call again the authorize() method, a new client will be created that will take as argument the "request_token_params" modified dict (see https://github.com/lepture/flask-oauthlib/blob/master/flask_oauthlib/client.py#L342, https://github.com/lepture/flask-oauthlib/blob/master/flask_oauthlib/client.py#L350).

This has happened to cause "OAuthException: Failed to generate request token" because of an Unauthorized response from the provider (in my particular case, Dropbox using OAuth 1.0).

This small PR solves this issue by doing a shallow copy of the "request_token_params" dict when calling make_client() with a token.

@lepture lepture merged commit 62d4e0d into lepture:master Jan 30, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

lepture added a commit that referenced this pull request Jan 30, 2015

Merge pull request #177 from PyBossa/master
Don't modify instance attributes when calling make_client with a token
@pyup-bot pyup-bot referenced this pull request Jun 23, 2017
@pyup-bot pyup-bot referenced this pull request Dec 23, 2017
@pyup-bot pyup-bot referenced this pull request Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.