atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

[Confluence] Token based authorization overridden by content of netrc

Open phantomGik opened this issue 9 months ago • 2 comments

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 avatar Mar 20 '25 08:03 phantomGik

@phantomGik could share how did you make the initialization step by .netrc ?

gonchik avatar Apr 01 '25 21:04 gonchik

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.

djeverett avatar Sep 12 '25 15:09 djeverett