-
Notifications
You must be signed in to change notification settings - Fork 430
SignedJwtAssertionCredentials has been removed: Why? #401
Comments
Thanks for noticing! The behavior has been moved onto There is a factory constructor: creds = ServiceAccountCredentials.from_p12_keyfile('[email protected]', '/path/to/keyfile.p12') |
@jefftune: are you able to point us to documentation that needs to be updated as a result of the change that we made on Friday? |
Example code using ServiceAccountCredentials:
To make in work in the appengine dev_server I installed:
|
@dhermes one problem I'm running into when I tried to migrate to We pull in our p12 keys dynamically, and the old behavior allowed us to not have to write the contents to a temp file locally. Any chance we could get a version of |
Ahhh @allenpc thanks for the heads up! We had discussed adding that as an intermediate constructor but decided "no one wants it". Proved wrong in less than 1 week! |
@nathanielmanistaatgoogle Shouldn't this issue be closed? Should a new issue be filed for the legit feature request of @allenpc? |
@dhermes @nathanielmanistaatgoogle I suggest do not close this issue until all documents are updated |
👍 good call |
@dhermes, moved my request out as a separate feature: #412 Agreed on keeping this open until all documentation is updated though. Here is another page that needs to get updated: https://developers.google.com/api-client-library/python/guide/aaa_oauth |
Thanks. |
Not that I like it... but keep the old version will be the solution for now... oauth2client==1.5.2 |
Authentication - one of the hardest things to get working in modern development and I've worked with Google authentication over the years and it's always been an absolute disaster, mainly because developers change things and leave the documentation out of date. I was hoping things might be different this time around but here it is again. The Python documentation is just plain wrong. Sorry so grumble to hard but man Google really puts in the effort to make things hard for developers trying to use its authentication. Again Google has just burned hours of my time - thanks. |
Thanks for taking the time to share @dukedougal. I can take the brunt of the blame for this change. We had 2 competing implementations for service accounts and as a programmer I just had to fix it. It didn't even occur to me to fix the various sets of docs on the Google developers site. I suppose there should be more great docstrings like in As for making a breaking change catching people off guard, I'm a bit unclear on what could have been done better. The major version was upgraded and the release notes have migration instructions. |
from oauth2client.service_account import ServiceAccountCredentials
credentials = ServiceAccountCredentials.from_json_keyfile_name(
key_file_name, scopes=[...]) |
Dear, I can confirm @dhermes code snippet and add my two cents for the p12 (confirmed to be working today).
but I had to switch this to master due to a bugfix just done today: requirements.txt:
|
Thanks @patroqueeet |
I got it to work, thanks for your quick response. But PLEASE update both the version on pip and your documentation. I'll probably come back here some day soon and think damn! I can't remember what I did to fix it, I hope the pip version is current and the documentation up to date. Don't do "the Google thing" and leave it for some other time. i.e. this is wrong and out of date: https://developers.google.com/api-client-library/python/auth/service-accounts If you were super awesome then you would also search Google for SignedJwtAssertionCredentials+python and look for where else this is referred to on the Google documentation and elsewhere on the net and fix the Google documentation, email the bloggers who have written posts about it and put comments on StackOverflow and other support forums where people might be going to try to work out why SignedJwtAssertionCredentials doesn't seem to work anymore. And finally, don't just chop the method out of the code. Leave it there with a nice error message for developers saying "this is now replaced with blah and you can find more information here". One final thing, don't just delete the old stuff from the docs, explain that they have been moved and replaced. That way developers won't remain in the dark as to why the function they expected does not seem to exist at all. |
I am not sure how many times referenced this import I wrote across last 5 years in various projects in different companies. I see i need to update 5 current projects of mine and ask other teams working with projects to upgrade their libraries. I wonder what would be the recommendation, I should fix a version of google-api-python-client/oauth2client in our code repos or ask all developers working to upgrade to this change and fix all projects to avoids reference issues in future !? I just realized this not affecting one branch we need to fix this on dev branches and manage merge issues later! |
In general the recommendation is to pin your packages. Major version changes will almost always introduce breaking changes, and even minor version release should be vetted before upgrading. We can't advance the state of this project without breaking changes. We've bumped the major version number for these changes as expected. @nathanielmanistaatgoogle @dhermes I can work on getting those docs updated today. |
Thanks a lot @jonparrott! |
Docs updated. Will need to be bumped again once #418 is resolved. |
Wow that was fast! Thanks |
@dhermes @jonparrott I noticed that the documents are updated, however, if I'm still using an old version, where could I find the document for the old version? |
Earth engine is likely using an older version of this library. You should file an issue on their repository asking them to upgrade. In the meantime, you can install |
Usually, rolling back to oauth2client 1.5.2 after updating the Earth Engine API (pip install earthengine-api==1.5.2) fixes the problem. I started an issue google/earthengine-api/issues/5, but feel free to add any additional information. |
Hi, @jonparrott & @cgmorton Thanks for the reply. I will check what is earthengine-api=1.5.2 equivalent in windows as in windows versions range from 0.0.3 to 0.1.88 . Initially i was using earthengine-api-0.1.87 (note that I am using windows) and oauth2client<2. To remove this error, i had tried installing pycrypto again, also i have cross checked with app.yaml for libraries but error remains as it is. |
Can you get earth engine to work outside of Google App Engine? Or better question, if you do:
Do you get an error? |
Actually after my last post, i had updated gcloud which had also updated Crypto libraries to latest version and then I got SignedJwtAssertionCredentials error posted earlier. Meaning, when now when I run simple python with import Crypto, it doesnot give error. For trial purpose, from ' %ANACONDA_PATH%\lib\site-packages ' i shifted following folders to a backup folder: So, i did the same for my lib folder in ' trendy-lights\lib '. Shifted those same packages to other backup folder. Additional Without installing Crypto again, i tried to start trendy-lights app using dev_appserver.py ./ which is as below:E:\googleearth\sample\crop_earthengine\demos\trendy-lights>dev_appserver.py ./ Updates are available for some Cloud SDK components. To install them, INFO 2016-07-19 11:09:40,792 devappserver2.py:769] Skipping SDK update check INFO 2016-07-19 11:09:56,788 module.py:788] default: "GET / HTTP/1.1" 500 - |
Can you do this in your code while running under dev-appserver?
|
This page has incorrect info about p12 based setup - https://developers.google.com/api-client-library/python/auth/service-accounts |
@dongseok0 those seem correct, which part in particular is incorrect? |
private_key_password need to be added for from_p12_keyfile method argument.
Need to be
|
The docs have been updated, but may not be published until later today. |
This docs still references |
I second @daguy666 We're struggling to migrate from earlier versions of |
@MeLight delegated credentials can be created with delegated_credentials = credentials.create_delegated('[email protected]') Please let me know if this doesn't work for you. |
And FYI, I'm in the process of updating the docs. We don't directly own those docs so it's difficult to coordinate across multiple teams. |
@jonparrott thanks for the reply. This is my code:
And this is the error I'm getting:
Please advise. Thanks |
@MeLight I don't think 'https://apps-apis.google.com/a/feeds/emailsettings/2.0/' is a valid scope. Does this work with oauth2client < 2.0.0? |
@jonparrott yes it works with previous versions, also you can find this scope documented here: https://developers.google.com/admin-sdk/email-settings/auth |
@MeLight can you share the working previous version code? Are you using the same service account for both? |
@jonparrott sure:
|
@jonparrott very embrassing - I think I've found the error. |
@MeLight I'm glad you figured it out. Do you mind sharing what the issue was? |
After permutating many combinations of keys/ids/permissions/scopes I forgot to change back the scope of admin sdk to Note for future generations: the above posted code can be used for domain delegation, and for your convenience I've pasted a gist with a working example: |
Thanks! Glad you got it figured out. On Wed, Aug 10, 2016, 4:14 PM Yuri Sh [email protected] wrote:
|
Please consider the following PR to re-add the legacy method signature: |
oauth2client 2.0 had a breaking API change, so it's better that we stick with 1.x if that's what we tested on. See googleapis/oauth2client#401 (This affects alertlib for sure, but may also affect us.) Auditors: tom Test plan: Ran the new commands manually on internal-services; we'll see if cron complains anymore.
To: @dhermes
I am currently using
class SignedJwtAssertionCredentials
, and as of 2 days ago, it was removed.oauth2client/client.py
dcd20c9#diff-d8b1525b7f161cbce2f6438636be9c38
What am I to use instead now?
Signed JWT is expected for Google Cloud API Authentication.
See
SignedJwtAssertionCredentials._generate_assertion()
The text was updated successfully, but these errors were encountered: