Skip to content

Using service account with domain-wide delegation still causing error "Precondition check failed" #336

Description

@jackred8

Summary

If using a service account with domain-wide authority delegation, run this python sample code with userId=me or any email address within the organization, it will return an error:

{'message': 'Precondition check failed.', 'domain': 'global', 'reason': 'failedPrecondition'}

Expected Behavior

Service account with correct scopes should be able to access any userIds

Actual Behavior

Service account with correct scopes always gets error

{'message': 'Precondition check failed.', 'domain': 'global', 'reason': 'failedPrecondition'}

Steps to Reproduce the Problem

Follow the instructions here https://developers.google.com/admin-sdk/directory/v1/guides/delegation#python

  1. Create the service account and credentials
  2. Delegate domain-wide authority to your service account
  3. Assign the correct scopes according to here https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs/list
  4. Run the code from here https://github.com/googleworkspace/python-samples/blob/master/gmail/snippet/settings%20snippets/update_signature.py

Specifications

  • Python 3.7.3
  • macOS Monterey Version 12.3.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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