# Failed to set scopes when creating new connection programmatically via Make API

**URL:** https://community.make.com/t/failed-to-set-scopes-when-creating-new-connection-programmatically-via-make-api/30130
**Category:** Questions
**Tags:** connections, api, google-drive
**Created:** [March 11, 2024, 10:04am UTC](https://community.make.com/t/failed-to-set-scopes-when-creating-new-connection-programmatically-via-make-api/30130 "2024-03-11T10:04:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Daniil\_Ornat](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@Daniil\_Ornat](https://community.make.com/u/Daniil_Ornat)
#### Post date: [March 11, 2024, 10:04am UTC](https://community.make.com/t/failed-to-set-scopes-when-creating-new-connection-programmatically-via-make-api/30130/1 "2024-03-11T10:04:37Z")

</div>

I need to create new scoped google drive connection with Make API call, I’ve created app in google cloud console with all needed scopes, redirect urls etc. got client id and secret and provided all parameters as described in Make API docs:

```auto
query = f'https://eu2.make.com/api/v2/connections'
body = {'accountName': 'New Google Drive for test',
        "accountType": "google",
        "clientId": 'id',
        "clientSecret": 'secret',
        "scopes": ['https://www.googleapis.com/auth/drive']}
params = {"teamId": TEAM_ID}
response = requests.post(query, json=body, headers=HEADERS, params=params)

```

Response:

```auto
{'connection': {'id': connectionID,
  'name': 'New Google Drive for test',
  'accountName': 'google',
  'accountLabel': 'Google',
  'packageName': None,
  'expire': None,
  'metadata': None,
  'teamId': teamID,
  'theme': '#fecd5f',
  'upgradeable': False,
  'scopes': 0,
  'scoped': True,
  'accountType': 'oauth',
  'editable': False,
  'uid': None}}

```

API call performed successfully but without provided scopes, also I can’t see created connection in my connections page.  
Here’s what I’m getting when use API call to test if it is scoped:

```auto
query = f'https://eu2.make.com/api/v2/connections/{connectionId}/scoped'
body = {"scope": "https://www.googleapis.com/auth/drive"}
params = {"teamId": TEAM_ID}
response = requests.post(query, headers=HEADERS, params=params, json=body)

```

Response:

```auto
{'connection': {'scoped': False}}

```

My Make api key for these calls has following scopes: ‘connections:write’, ‘connections:read’

---

<div class="post-metadata">

### Author: ![PierreL](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@PierreL](https://community.make.com/u/PierreL)
#### Post date: [May 6, 2024, 8:53am UTC](https://community.make.com/t/failed-to-set-scopes-when-creating-new-connection-programmatically-via-make-api/30130/2 "2024-05-06T08:53:31Z")

</div>

@Tiwa_Shada @Iveta_Sofkova

---

<div class="post-metadata">

### Author: ![Darin\_Patterson](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@Darin\_Patterson](https://community.make.com/u/Darin_Patterson)
#### Post date: [May 10, 2024, 6:43pm UTC](https://community.make.com/t/failed-to-set-scopes-when-creating-new-connection-programmatically-via-make-api/30130/3 "2024-05-10T18:43:13Z")

</div>

Hi @Daniil_Ornat , I have some experience in this topic that I can certainly share.

I just posted a whole bunch of details related to this topic on this [post](https://community.make.com/t/make-api-numerous-issues-with-create-connection/4861). You’ll want to review that as it relates to the challenge you are encountering.

Essentially, the scopes aren’t listed in the Make connection until the actual authorization (with the 3rd party provider) is completed. General steps are:

1. Create connection in Make
2. Get redirect URL from Make
3. Use that URL to redirect the user to the 3rd party (that url includes your originally requested scopes)
4. Once the user authorizes the scopes, and you verify the connection, you’ll be able to see the scope in the Make connection (because, at that point, they were actually authorized).

I hope that is useful.

---

<div class="post-metadata">

### Author: ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)
#### Post date: [August 8, 2024, 6:49pm UTC](https://community.make.com/t/failed-to-set-scopes-when-creating-new-connection-programmatically-via-make-api/30130/4 "2024-08-08T18:49:01Z")

</div>


