[Confluence] Token based authorization overridden by content of netrc
An issue with Confluence API authentication
Description
When using token-based authentication, I encountered a 401 Unauthorized error. However, when testing the same token with curl, it worked correctly. After further investigation, I found that I had an outdated .netrc file with incorrect credentials. Once I removed the .netrc file, the token authentication started working as expected.
Unexpected Behavior
The library appears to prioritize .netrc credentials over the explicitly provided token, leading to an authentication failure when incorrect credentials are present in .netrc.
Expected Behavior
When a token is explicitly provided, .netrc should be ignored, ensuring that token authentication functions correctly.
Environment
python==3.8 atlassian-python-api==3.41.21 requests==2.31.0
@phantomGik could share how did you make the initialization step by .netrc ?
I have had the same with
machine confluence.<my-company>.com login <my-email> password <my-api-key>
in my netrc file. The same for using the atlassian.Jira class. I think you just need to set self._session.trusted_env = False in rest_client.py to fix.