# 401 Error: Authentication credentials not found.

**URL:** <https://community.hubspot.com/t/401-error-authentication-credentials-not-found/84789>\
**Category:** APIs & Integrations\
**Tags:** oauth\
**Created:** [July 6, 2023, 8:20am UTC](https://community.hubspot.com/t/401-error-authentication-credentials-not-found/84789 "2023-07-06T08:20:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PMunar](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@PMunar](https://community.hubspot.com/u/PMunar)\
**Post date:** [July 6, 2023, 8:20am UTC](https://community.hubspot.com/t/401-error-authentication-credentials-not-found/84789/1 "2023-07-06T08:20:33Z")

</div>

Dear hubspot community,

I am writing because I am experiencing some strange problem. Yesterday I wrote a small python script to get the “feedback\_submissions” data from one of our hubspot accounts.

It worked fine and I could retrieve data normally.

Today I tried again to retrieve the same data (the script did not change at all) and I got the 401 error (see code and error below).

Can anyone help me understand what can be happening?

The code I am executing is the following:

`import hubspotfrom pprint import pprintfrom hubspot.crm.objects.feedback_submissions import ApiExceptionclient = hubspot.Client.create(access_token="my_access_token")try:api_response = client.crm.objects.feedback_submissions.basic_api.get_page(limit=1, archived=False, properties=['hs_sentiment', 'hs_survey_type'])print(api_response)except ApiException as e:print("Exception when calling basic_api->get_page: %s\n" % e)`

In my case, the variable “my\_access\_token” has the actual access token that I get when I created the private app within my hubspot account, with the correct scopes.

And the error I get is:

```auto
Exception when calling basic_api->get_page: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 06 Jul 2023 07:53:52 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': '299', 'Connection': 'keep-alive', 'CF-Ray': '7e2646c6eb982fbb-MAD', 'CF-Cache-Status': 'DYNAMIC', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload', 'Vary': 'origin, Accept-Encoding', 'Access-Control-Allow-Credentials': 'false', 'x-envoy-upstream-service-time': '3', 'x-evy-trace-listener': 'listener_https', 'x-evy-trace-route-configuration': 'listener_https/all', 'x-evy-trace-route-service-name': 'envoyset-translator', 'x-evy-trace-served-by-pod': 'iad02/hubapi-td/envoy-proxy-598c95b5b7-79ph8', 'x-evy-trace-virtual-host': 'all', 'X-HubSpot-Auth-Failure': '401 Unauthorized', 'X-HubSpot-Correlation-Id': 'c949e659-d2dd-44f5-a77b-ffbcded8b98d', 'x-request-id': 'c949e659-d2dd-44f5-a77b-ffbcded8b98d', 'X-Trace': '2B9FE3E2A7DC4E6CFB4AFD766A17C77E79B265D346000000000000000000', 'Report-To': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=IiJ06vzh2w4NUK1cIIHQMApGMMV1itYrNWljQQPQgohUCfJgQYFjsUTcziC0CEK4trOABdt2Ts5jX7Jz60PTM%2BvrFxqiZsBJ%2F5ybeayujIZmEI%2BCBNXJ4FdPBxJHIZsG"}],"group":"cf-nel","max_age":604800}', 'NEL': '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}', 'Server': 'cloudflare', 'alt-svc': 'h3=":443"; ma=86400'})
HTTP response body: {"status":"error","message":"Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview","correlationId":"c949e659-d2dd-44f5-a77b-ffbcded8b98d","category":"INVALID_AUTHENTICATION"}

```

As said, yesterday it worked and now it does not without changing the code.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![skimura](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@skimura](https://community.hubspot.com/u/skimura)\
**Post date:** [July 6, 2023, 10:38am UTC](https://community.hubspot.com/t/401-error-authentication-credentials-not-found/84789/2 "2023-07-06T10:38:47Z")

</div>

@PMunar

Hi.

How about try this?

Quote: README

```lia-code-sample
# client = hubspot.Client.create(access_token="my_access_token")
client = HubSpot(access_token='your_access_token')

```

> **[GitHub - HubSpot/hubspot-api-python: HubSpot API Python Client Libraries for V3 version...](https://github.com/HubSpot/hubspot-api-python)**
>
> HubSpot API Python Client Libraries for V3 version of the API

> <https://github.com/HubSpot/hubspot-api-python/blob/master/hubspot/client.py#L16>

This method may not be suitable.

```lia-code-sample
def create(cls, **kwargs):
 return cls(**kwargs)

```

Thanks.

---

<div class="post-metadata">

**Author:** ![PMunar](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@PMunar](https://community.hubspot.com/u/PMunar)\
**Post date:** [July 6, 2023, 2:56pm UTC](https://community.hubspot.com/t/401-error-authentication-credentials-not-found/84789/3 "2023-07-06T14:56:00Z")

</div>

Hi @skimura ,

I have also tried the method you suggest and also this variation:

```auto
from hubspot import HubSpot

api_client = HubSpot()
api_client.access_token = 'your_access_token'

```

but it does not work either.

As I said, yesterday it worked fine and today it does not. I cannot figure out why.

---

<div class="post-metadata">

**Author:** ![skimura](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@skimura](https://community.hubspot.com/u/skimura)\
**Post date:** [July 7, 2023, 12:14am UTC](https://community.hubspot.com/t/401-error-authentication-credentials-not-found/84789/4 "2023-07-07T00:14:16Z")

</div>

@PMunar

I tried your code and it worked.

Is your `hubspot-api-client` is latest?

In my case, same error happned.

So I updated the library version.

`pip install --upgrade hubspot-api-client`

I ran it again and it was successful.

Please check library version.

If it’s not the latest version, try updating it.

Thanks.

---

<div class="post-metadata">

**Author:** ![PMunar](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@PMunar](https://community.hubspot.com/u/PMunar)\
**Post date:** [July 11, 2023, 12:55pm UTC](https://community.hubspot.com/t/401-error-authentication-credentials-not-found/84789/5 "2023-07-11T12:55:37Z")

</div>

Hi!

It turned out it was due to some libaray issue. Your suggestion regarding an update to the hubspot api library made me think about it.
