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

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
lepture added a commit that referenced this pull request Jan 30, 2015
Don't modify instance attributes when calling make_client with a token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants