Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The caller does not have permission #37

Open
terraincognitas opened this issue Mar 24, 2023 · 1 comment
Open

The caller does not have permission #37

terraincognitas opened this issue Mar 24, 2023 · 1 comment

Comments

@terraincognitas
Copy link

terraincognitas commented Mar 24, 2023

Hi. I'm receiving the error "The caller does not have permission" when running this.

I've configured the app in Google Console to allow the Google Sheets API—creating an API Key and a Service Account. The API Key is used in the app as GATSBY_GOOGLE_SHEETS_API_KEY, GATSBY_GOOGLE_SHEETS_SHEET_ID added from the Sheet URL, and the Service Account email was added to the Google Sheet with full Editor permissions.

I'm not entirely sure which apiKey value to set in the application env variable. Where is the correct API Key found/created? Is it created in the Service Account, the general Credentials settings in Console, or one of the values in the json file credentials?

Application Code (typescript)

const { data, loading, error } = useGoogleSheets({
    apiKey: process.env.GATSBY_GOOGLE_SHEETS_API_KEY as string,
    sheetId: process.env.GATSBY_GOOGLE_SHEETS_SHEET_ID as string,
  });

Console error:

{
    "code": 403,
    "message": "The caller does not have permission",
    "status": "PERMISSION_DENIED"
}
@terraincognitas
Copy link
Author

I tracked this down to being a result of the Google Sheet having general sharing access set to Restricted. It worked when the sheet was temporarily made Public.

How do I allow read/write access to this sheet but keep the sheet sharing to Restricted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant