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

Quick fix to allow API tokens to be used #29

Merged
merged 2 commits into from
Jan 26, 2021

Conversation

martwana
Copy link
Contributor

@martwana martwana commented Jan 25, 2021

I've modified this library with minimal changes to support being able to use a TeamCity access token.

I'm not entirely sure why there was some functionality to enable this, but it was not fully implemented.

Usage:

from dohq_teamcity import TeamCity
from dohq_teamcity.configuration import Configuration

config = Configuration()
config.api_key = {'mytoken': 'XXXXXXXXXXXXXXX'}
config.api_key_prefix = {'mytoken': 'Bearer'}
config.active_api_key = 'mytoken'

tc = TeamCity("https://teamcity.example.uk", auth_settings=["Token"], configuration=config)

@vasokot vasokot merged commit a4140b4 into devopshq:develop Jan 26, 2021
@allburov
Copy link
Member

Nice job! Could you add a little note about this type of authentication in readme?

@timka-s
Copy link

timka-s commented Feb 3, 2021

After MR broke code: TeamCity("https://teamcity.example.uk", auth=(login, password))
Now raised error HTTP response body: Authentication required

@martwana
Copy link
Contributor Author

martwana commented Feb 3, 2021

Yeah this was pushed as a quick fix to enable token auth. I did not check username/password login as personally I think its a bad practice to use in scripts.

That authentication method should really be deprecated in favour or other more secure methods.

I've added another commit to hopefully fix that @timka-s on PR #32

Can you give that a test.

@cpages
Copy link

cpages commented Apr 9, 2021

Thanks for fixing that. Just a note that your example should read 'auth_settings=["Token"]', not auth. It took me a while to figure out why it was not working for me

@martwana
Copy link
Contributor Author

martwana commented Apr 9, 2021

Thanks for fixing that. Just a note that your example should read 'auth_settings=["Token"]', not auth. It took me a while to figure out why it was not working for me

Sorted that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants