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

Add 'openid' scope to gcloud command #589

Merged
merged 2 commits into from
Mar 11, 2021
Merged

Add 'openid' scope to gcloud command #589

merged 2 commits into from
Mar 11, 2021

Conversation

heisencoder
Copy link
Contributor

When I run with the gcloud auth command as shown, I get this error:

ERROR: gcloud crashed (Warning): Scope has changed from "https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/accounts.reauth" to "https://www.googleapis.com/auth/accounts.reauth https://www.googleapis.com/auth/cloud-platform openid https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/userinfo.email".

This error message shows that the openid scope needs to be added. After adding this scope, the error message goes away.

See dbt-labs/dbt-core#3040 for more context.

When I run with the `gcloud auth` command as shown, I get this error:

```
ERROR: gcloud crashed (Warning): Scope has changed from "https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/accounts.reauth" to "https://www.googleapis.com/auth/accounts.reauth https://www.googleapis.com/auth/cloud-platform openid https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/userinfo.email".
```

This error message shows that the `openid` scope needs to be added.  After adding this scope, the error message goes away.

See dbt-labs/dbt-core#3040 for more context.
@heisencoder heisencoder requested a review from clrcrl as a code owner March 2, 2021 21:47
Copy link
Collaborator

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @heisencoder!

Both commands (with and without openid) work for me locally. I'm guessing this has something to do with organizational settings for OpenID Connect?

@heisencoder
Copy link
Contributor Author

Unfortunately, I don't know the reason why we need to add the openid scope, but do know that adding it (at least for me) fixed my error.

@heisencoder
Copy link
Contributor Author

I'm happy either adding this change or leaving it out if it only affects my particular setup.

@jtcohen6
Copy link
Collaborator

jtcohen6 commented Mar 10, 2021

@heisencoder Thanks for your patience as I try to figure out what's what!

Per the ongoing conversation in fishtown-analytics/dbt#2953, after some more testing on my end, I think it's possible that we could trim userinfo.email and cloud-platform from the required scopes in application-default. I wonder if you see the same error when you revoke all and instead run:

gcloud auth application-default login \
  --scopes=https://www.googleapis.com/auth/bigquery,\
https://www.googleapis.com/auth/drive.readonly

If you still see an error, fixed by the inclusion of openid, then we'll have confirmed that this is required for some users' gcloud authentication and we can definitely add it in.

@heisencoder
Copy link
Contributor Author

@jtcohen6 This sounds great! I'm a big fan of narrowing the scopes!

I've run the gcloud command, and can confirm that by removing the userinfo.email scope, I no longer see the error with needing openid. I was also able to successfully read from an external table backed by a Google Sheet using the Python client!

Thanks!
-Matt

Based on feedback from Jeremy.
@heisencoder
Copy link
Contributor Author

Based on the feedback, I updated the text and tested the changes locally to verify correct syntax.

Copy link
Collaborator

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! Let's give this a go here for now. If we're proven wrong, it's much easier to update the docs site than dbt-bigquery code.

@jtcohen6 jtcohen6 merged commit 2ff1679 into dbt-labs:current Mar 11, 2021
@HeddeCrisp
Copy link

Hi all, the above solutions did not work for me unfortunately. I still get the same error message. I am using dbt=0.20.1.
Any ideas on how to solve? I revoked my access and tried the recommended commands, but it did not work.

nghi-ly pushed a commit that referenced this pull request Jun 4, 2024
REPO SYNC - Public to Private
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

Successfully merging this pull request may close these issues.

3 participants