Support oauth2client >= 2.0 for service accounts
See original GitHub issueThe function oauth2client.client.SignedJwtAssertionCredentials() (called in ServiceAccountCredentials() in ee/_helper.py) was removed in versions >=2.0 of oauth2client (changelog). This causes the the following exception to be raised when trying to initialize EE with service account credentials using newer versions of oauth2client:
return oauth2client.client.SignedJwtAssertionCredentials(
AttributeError: 'module' object has no attribute 'SignedJwtAssertionCredentials'
Typically I roll back oauth2client to 1.5.2, but other modules (like gcloud) rely on the newer version of oauth2client, which makes it difficult to use both modules in the app.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Using OAuth 2.0 for Server to Server Applications | Authorization
To support server-to-server interactions, first create a service account for your project in the API Console. If you want to access user data...
Read more >oauth2client.service_account module
Service Account credential for OAuth 2.0 signed JWT grants. Supports. JSON keyfile (typically contains a PKCS8 key stored as PEM text) .p12 key...
Read more >How to Use Google OAuth 2 With a Service Account - Soliant
Learn how to leverage Google OAuth 2 with a service account for your business application from experienced developers at Soliant Consulting.
Read more >Setting up OAuth 2.0 - Google Cloud Platform Console Help
To use OAuth 2.0 in your application, you need an OAuth 2.0 client ID, which your ... For information about setting up service...
Read more >Create short-lived credentials for a service account
The following credential types are supported: OAuth 2.0 access tokens; OpenID Connect ID tokens; Self-signed JSON Web Tokens (JWTs); Self-signed binary objects ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I discovered the same issue and wrote a workaround in my application based on the issue #401 you have referenced.
Instead of calling
authorization = ee.ServiceAccountCredentials(MY_SERVICE_ACCOUNT, MY_PRIVATE_KEY_FILE)
ee.Initialize(authorization)
you can use the following
from oauth2client.service_account import ServiceAccountCredentials
from ee import oauth
authorization = ServiceAccountCredentials.from_p12_keyfile(MY_SERVICE_ACCOUNT, MY_PRIVATE_KEY_FILE, scopes=oauth.SCOPE)
ee.Initialize(authorization)
Given that it works with the preferred JSON key format and the current Python API release, I would suggest closing it.