# Not able to get the access\_key with sample-python-app.

**URL:** <https://community.hubspot.com/t/not-able-to-get-the-access-key-with-sample-python-app/110858>\
**Category:** APIs & Integrations\
**Tags:** free, starter\
**Created:** [July 8, 2024, 4:07pm UTC](https://community.hubspot.com/t/not-able-to-get-the-access-key-with-sample-python-app/110858 "2024-07-08T16:07:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AT16](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/at16/32/203174_2.png) [@AT16](https://community.hubspot.com/u/AT16)\
**Post date:** [July 8, 2024, 4:07pm UTC](https://community.hubspot.com/t/not-able-to-get-the-access-key-with-sample-python-app/110858/1 "2024-07-08T16:07:07Z")

</div>

Hi,  
I’m using the [sample-apps-oauth/python](https://github.com/HubSpot/sample-apps-oauth)and after the app authorization it throws an error.  
I’ve already created the private app and added the client ID and secret.

Authorization failed because the provided scopes are insufficient. Please contact the app developer.

snippet on the landing page :-

```auto
// app/routes/oauth.py - Generate URL for OAuth
from hubspot.utils.oauth import get_auth_url
auth_url = get_auth_url(
 scopes=('contacts',),
 client_id=os.environ.get('HUBSPOT_CLIENT_ID'),
 redirect_uri=get_redirect_uri(),
)

```

---

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [July 8, 2024, 4:48pm UTC](https://community.hubspot.com/t/not-able-to-get-the-access-key-with-sample-python-app/110858/2 "2024-07-08T16:48:09Z")

</div>

@AT16 - perhaps there is some confusion between using Oauth and private app tokens here. You state you are using a private app and it’s associated scope settings. The auth token for any Python call using that method would be included in the header of an API call.

headers = {

‘Content-Type’: ‘application/json’,

‘Authorization’: 'Bearer ’ + api\_token,

}

So that it could be used in the following way:

response = requests.request(“GET”, request\_url, headers=headers)

Hope I don’t have the wrong end of the stick here.

Steve
