# Yet another... HTTPError: 403 Client Error: Invalid or non-existent authentication information

**URL:** <https://travis-ci.community/t/yet-another-httperror-403-client-error-invalid-or-non-existent-authentication-information/8857>\
**Category:** Python\
**Created:** [June 2, 2020, 5:41pm UTC](https://travis-ci.community/t/yet-another-httperror-403-client-error-invalid-or-non-existent-authentication-information/8857 "2020-06-02T17:41:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmagno](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@gmagno](https://travis-ci.community/u/gmagno)\
**Post date:** [June 2, 2020, 5:41pm UTC](https://travis-ci.community/t/yet-another-httperror-403-client-error-invalid-or-non-existent-authentication-information/8857/1 "2020-06-02T17:41:54Z")

</div>

Hello dear friends,

I thought I should share this issue I’m having publishing a python package with to PyPI.

It seems to be authenticating correctly with my user here: [https://travis-ci.com/github/gmagno/pycut/jobs/342784699#L155](https://travis-ci.com/github/gmagno/pycut/jobs/342784699#L155)

but eventually fails with: HTTPError: 403 Client Error: Invalid or non-existent authentication information.

Here: [https://travis-ci.com/github/gmagno/pycut/jobs/342784699#L257](https://travis-ci.com/github/gmagno/pycut/jobs/342784699#L257)

Any tips would be much appreciated.

Thanks in advance,  
gmagno

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 2, 2020, 9:19pm UTC](https://travis-ci.community/t/yet-another-httperror-403-client-error-invalid-or-non-existent-authentication-information/8857/2 "2020-06-02T21:19:35Z")

</div>

> [@401 - Bad credentials (Octokit::Unauthorized)](https://travis-ci.community/t/401-bad-credentials-octokit-unauthorized/5355/2):
>
> Your credentials are wrong. Since your build runs on [https://travis-ci.com](https://travis-ci.com), you need to use the .com API endpoint to encrypt your API key. Try travis encrypt --pro

---

<div class="post-metadata">

**Author:** ![gmagno](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@gmagno](https://travis-ci.community/u/gmagno)\
**Post date:** [June 2, 2020, 9:23pm UTC](https://travis-ci.community/t/yet-another-httperror-403-client-error-invalid-or-non-existent-authentication-information/8857/3 "2020-06-02T21:23:19Z")

</div>

Hey, thank you for your reply.  
Is there anywhere in the log you can see that I’m hitting the wrong API? Cause I am confident I was not. I’ve actually tried all possibilities already, --org, --com and --pro.

Both `travis login` and `travis encrypt` commands I am passing --pro.

---

<div class="post-metadata">

**Author:** ![gmagno](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@gmagno](https://travis-ci.community/u/gmagno)\
**Post date:** [June 2, 2020, 9:34pm UTC](https://travis-ci.community/t/yet-another-httperror-403-client-error-invalid-or-non-existent-authentication-information/8857/4 "2020-06-02T21:34:37Z")

</div>

Okay, apparently the problem was that I was using the wrong user. When using PyPI API tokens you need to use ` __token__ ` as user. I thought travis would take care of this.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 2, 2020, 9:55pm UTC](https://travis-ci.community/t/yet-another-httperror-403-client-error-invalid-or-non-existent-authentication-information/8857/6 "2020-06-02T21:55:16Z")

</div>

[https://docs.travis-ci.com/user/deployment/pypi/](https://docs.travis-ci.com/user/deployment/pypi/) clearly says that you need to specify ` __token__ ` explicitly.  
Apparently, Travis aren’t going to follow PyPI’s whim each time they change the meaning of the values.

However, ` __token__ ` is no longer “whim”, it’s been there for pretty long AFAIK, so it does make sense as a default.  
You can create a PR against [https://github.com/travis-ci/dpl/](https://github.com/travis-ci/dpl/) and/or create a feature request if you wish.
