Skip to content

fix oauth token access#174

Closed
deanrock wants to merge 1 commit intopython-gitlab:oauthfrom
deanrock:oauth
Closed

fix oauth token access#174
deanrock wants to merge 1 commit intopython-gitlab:oauthfrom
deanrock:oauth

Conversation

@deanrock
Copy link
Copy Markdown

authorization header doesn't have a colon in it's value, requests' auth parameter overrides custom authorization header

(and there was a PEP8 error for line 441)

@dzervas
Copy link
Copy Markdown

dzervas commented Oct 27, 2016

I think that this will have problems with HTTP requests apart from GET (have you tested PUT/PUSH/DELETE?) 'cause the authorization header is overwritten by basic auth.

I fixed all these just yesterday (I wish I could see your request earlier...). Have a look #176

@deanrock
Copy link
Copy Markdown
Author

@dzervas yes, you are correct, I didn't test with other requests :/

can you please fix example: 3164a0b#diff-8a23d682236897c1a2f5bafede722cb3L28 ?

@dzervas
Copy link
Copy Markdown

dzervas commented Oct 27, 2016

I think that the example should not be fixed, as the private key is not static (and you should give that "feel" in the documentation). It's not doing the whole auth thing (you have to talk with the server to gain the key).

@gpocentek
Copy link
Copy Markdown
Contributor

@deanrock @dzervas thank you for your patches and comments, really appreciated. I should be able to review and test the changes next week.

Copy link
Copy Markdown
Contributor

@gpocentek gpocentek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my suggestion inline, I think there's a nicer way to handle both oauth and basic HTTP auth.

Thanks!

auth = requests.auth.HTTPBasicAuth(
self.http_username,
self.http_password)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one thing bothering me here: with oauth token we explicitly define headers, with basic HTTP auth we don't and use a python-requests feature instead. I'd prefer to have the same method for both authentication methods.

Updating the _create_headers method might be the easiest way to achieve consistency. This would also avoid code duplication in the _raw_* methods.

What do you think about this?

@gpocentek
Copy link
Copy Markdown
Contributor

Hi @deanrock

This MR has not been updated in almost a year so I'm closing it. #357 is a new proposal to support oauth.

Thank you for your time.

@gpocentek gpocentek closed this Nov 4, 2017
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.

3 participants