Skip to content

[Bug]: Gmail scopes incorrect for some tools #2463

@tomgreeEn

Description

@tomgreeEn

SDK Language

Both

SDK Version

API

Runtime Environment

API

Environment

Local Development

Describe the Bug

The scopes returned from the api for some Gmail tools are incorrect - they are more permissive than required, and are not included in the defualt scopes requested when creating the connection.

Specifically this scope is listed as required:
https://www.googleapis.com/auth/contacts

For GMAIL_GET_CONTACTS, GMAIL_GET_PEOPLE, GMAIL_SEARCH_PEOPLE

These are all GET requests and do not require the read/write permissions of https://www.googleapis.com/auth/contacts
as they already have enough access via https://www.googleapis.com/auth/contacts.readonly etc

Steps to Reproduce

Add API key to the below request and send

Minimal Reproducible Example

// Get tool by slug (GET /api/v3/tools/:tool_slug)
const response = await fetch("https://backend.composio.dev/api/v3/tools/GMAIL_SEARCH_PEOPLE?toolkit_versions=latest", {
  method: "GET",
  headers: {
    "x-api-key": "..."
  },
});

const body = await response.json();
console.log(body);

/*
{
  "slug": "GMAIL_SEARCH_PEOPLE",
  "name": "Search People",
  "toolkit": {
    "slug": "gmail",
    "name": "gmail",
    "logo": "https://logos.composio.dev/api/gmail"
  },
  ...
  "scopes": [
    "https://www.googleapis.com/auth/contacts", // <---- this includes write access and is not required for searching people; and it's not included in default connection scope
    "https://www.googleapis.com/auth/contacts.readonly" <--- this is the only one we actually need
  ],
}

*/

Error Output / Stack Trace

See comment above

Reproducibility

  • Always reproducible
  • Intermittent / Sometimes
  • Happened once, can’t reproduce

Additional Context or Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions