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

insufficientScopes error after upgrading to 1.10.0 #477

Open
ramonpm opened this issue Feb 12, 2024 · 0 comments
Open

insufficientScopes error after upgrading to 1.10.0 #477

ramonpm opened this issue Feb 12, 2024 · 0 comments

Comments

@ramonpm
Copy link

ramonpm commented Feb 12, 2024

Environment details

  • OS: n/a
  • Ruby version: 3.2.2
  • Gem name and version: googleauth 1.10.0

Steps to reproduce

  1. Execute the following code and see the error /home/ramon/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/google-apis-core-0.11.3/lib/google/apis/core/http_command.rb:244:in check_status: insufficientScopes: The granted scopes do not give access to all of the requested spaces. (Google::Apis::ClientError)
auth_credentials = JSON.parse(credentials_json)
client = ::Google::Apis::DriveV3::DriveService.new
client.authorization     = Google::Auth::ServiceAccountCredentials.new(token_credential_uri: auth_credentials['token_uri'],
                                                                               audience: auth_credentials['token_uri'],
                                                                               scope: 'https://www.googleapis.com/auth/drive.metadata.readonly',
                                                                               issuer: auth_credentials['client_email'],
                                                                               signing_key: OpenSSL::PKey::RSA.new(auth_credentials['private_key']),
                                                                               project_id: auth_credentials['project_id'])
client.authorization.sub = 'your-email@gmail.com'
drive_fields_to_return = 'files(webViewLink, name, id, iconLink, modifiedTime, owners/displayName, owners/photoLink)'
client.list_files(q: "fullText contains 'test'", fields: drive_fields_to_return, page_size: 12)
  1. Downgrade to 1.8.1
  2. Execute the same code and see it working fine

I'm not sure if this is reproducible by anyone, perhaps it's related to my google project configs. I'd appreciate any help to how to fix the google project though if that's the case.

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