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

Issues with how basic auth is being done when in Python 3 #49

Closed
ashic opened this issue Mar 2, 2018 · 2 comments
Closed

Issues with how basic auth is being done when in Python 3 #49

ashic opened this issue Mar 2, 2018 · 2 comments

Comments

@ashic
Copy link

ashic commented Mar 2, 2018

I'm seeing a problem anywhere this library is using client secret basic as the auth mechanism. The issue boils down to:

 bas = 'foo:bar'
 bytes = bytearray(bas, 'utf-8')
 s = 'Basic %s' % b64encode(bytes)
 s
"Basic b'Zm9vOmJhcg=='"
 s2 = 'Basic %s' % b64encode(bytes).decode('utf-8')
 s2
'Basic Zm9vOmJhcg=='

In python 3.6.4, serializing bytes is outputting b'actual_value', which is then failing authentication. Adding a .decode('utf-8') results in a string, and the b'' isn't added anymore. This doesn't manifest in python 2.

The following works in both python 2 and 3:

 bas = 'foo:bar'
 bytes = bytearray(bas, 'utf-8')
 s = str('Basic %s' % b64encode(bytes).decode('utf-8'))
 s

Would this be something you're willing to incorporate? I can get a PR ready for this if so. (I think this affects #44 as well).

@marcvs
Copy link
Contributor

marcvs commented Jul 18, 2018

I'm hitting the same bug here and need this to be fixed.

I'm also willing to generate PRs, if this project is still alive

What is the status of flask-oidc?

@puiterwijk
Copy link
Owner

Thanks to @marcvs's patch, this got fixed: 4bfd891

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

3 participants