Skip to content

insufficientScopes error after upgrading to 1.10.0 #477

@ramonpm

Description

@ramonpm

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.

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