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

client_id and client_secret in docs should be raw string #59

Closed
synasius opened this issue Jul 19, 2013 · 3 comments
Closed

client_id and client_secret in docs should be raw string #59

synasius opened this issue Jul 19, 2013 · 3 comments

Comments

@synasius
Copy link
Contributor

I recently tried requests-oauthlib with django-oauth-toolkit following the webapplication flow tutorial.

If the provider use '' char in client_id and client_secret strings that will be interpreted as an escape sequence and you'll obtain an InvalidClientId error when you try to exchange the token.
For instance if the client_id XQcKemTaz}^1GW6C@_;@KHDh@yo\4Br\jv/,;5\1:

>>> client_id = 'XQcKemTaz}^1GW6C@_;@KHDh@yo\4Br\jv/,;5\1'
>>> print client_id
XQcKemTaz}^1GW6C@_;@KHDh@yoBr\jv/,;5

As you can see the input value and output value are different.
To avoid this behavior you can use raw python string syntax:

>>> client_id = r'XQcKemTaz}^1GW6C@_;@KHDh@yo\4Br\jv/,;5\1'
>>> print client_id
XQcKemTaz}^1GW6C@_;@KHDh@yo\4Br\jv/,;5\1

I can open a PR if you want

@Lukasa
Copy link
Member

Lukasa commented Jul 19, 2013

Hi @synasius, thanks for raising this issue! Whereabouts in the library is this a problem?

@synasius
Copy link
Contributor Author

Hi,

I stumbled on the problem following this: https://requests-oauthlib.readthedocs.org/en/latest/oauth2_workflow.html#id1

This is a documentation problem, not a bug in the library code.

What I'm trying to report is that you should use raw string syntax in your documentation when you assign values to client_id or client_secret otherwise, as I described above, if the provider uses '' char you'll have problems in obtaining the authorization.

It seems that the library is buggy but it isn't... it's just a documentation issue :)

Am I wrong?

@Lukasa
Copy link
Member

Lukasa commented Jul 19, 2013

Ah, no. =) Just wanted to make sure there wasn't a serious library bug. =) Feel free to open a pull request with the changes. =)

synasius added a commit to synasius/requests-oauthlib that referenced this issue Jul 22, 2013
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

No branches or pull requests

2 participants