Skip to content

Permission difficulties through gs4_auth() and gs4_auth_configure() #310

Open
@JustGottaCAT

Description

@JustGottaCAT

My company has an internal Google domain and I'm attempting to read a Google spreadsheet from it. I keep getting permission errors when I try to use gs4_auth() or gs4_auth_configure().

If I use gs4_auth() I am taken to the authorization screen, choose "Yes", and then get this error:
image

I allowed "Tidyverse API Packages" access via admin.google.com > Security > Access and data control > API Controls (for some reason there were 6 IDs). My company's domain is "Trusted and block-exempt". gs4_auth() still did not work.

I also tried generating an API key and client ID for the Google Sheets API and used that:

library(googlesheets4)
library(gargle)

google_client <- gargle_oauth_client_from_json(
path = 'path_to_Google_Sheets_client_ID_json_file.json',
name = 'Name of client ID in Google Cloud Console')

gs4_auth_configure(client = google_client, api_key = 'Google_Sheets_API_generated_key')

gs4_oauth_app()

<gargle_oauth_client>
name: Name of client ID in Google Cloud Console
id: Client ID in Google Cloud Console
secret: <REDACTED>
type: installed
redirect_uris: http://localhost

But I get a permission error when I actually try to read in a sheet:

read_sheet('sheet_ID')

Error in `gs4_get_impl_()`:
! Client error: (403) PERMISSION_DENIED
• Client does not have sufficient permission. This can happen because the OAuth token does not have the right scopes,
  the client doesn't have permission, or the API has not been enabled for the client project.
• The caller does not have permission

Eventually I would like this all done using encrypted service account credentials and would like to publish an Rmd with my code on our internal Posit Server, but I figure that is down the line if I can't even get the above to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions