Skip to content

Getting 401 unauthorized client when trying to impersonate with service account #159

Description

@tonyzeng91

Hi - I am getting the follow error when trying to impersonate a service account.

{:error, %RuntimeError{message: "unexpected status 401 from Google\n\n{\n  \"error\": \"unauthorized_client\",\n  \"error_description\": \"Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.\"\n}\n"}}
# steps to impersonate
credentials = "credentials.json" |> File.read!() |> Jason.decode!()
claims = %{"sub" => "<IMPERSONATED_ACCOUNT_EMAIL>", "scope" => "https://www.googleapis.com/auth/cloud-platform"}
Goth.Token.fetch(source: {:service_account, credentials, [claims: claims]})

I am able to impersonate with a similar library in Python. Any idea why I am getting this error using the Goth lib?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions