GeezerVison is showing github.com — Document how to use Service Accounts with dev_appserver · Issue #574 · googleapis/google-cloud-python
Document how to use Service Accounts with dev_appserver #574Labels priority: p2Moderately-important priority. Fix may not be included in next release. DescriptionIt can be done via
$ dev_appserver.py \
> --appidentity_email_address ${EMAIL_ADDRESS} \
> --appidentity_private_key_path ${PATH_TO_KEY} \
> ${APPLICATION_DIR}
This will make implicit credentials "just work" on the dev appserver for GAE. Activitydhermes commented on Jan 28, 2015 ContributorAuthor More actions From dev_appserver.py --help
Application Identity:
--appidentity_email_address APPIDENTITY_EMAIL_ADDRESS
email address associated with a service account that
has a downloadable key. May be None for no local
application identity. (default: None)
--appidentity_private_key_path APPIDENTITY_PRIVATE_KEY_PATH
path to private key file associated with service
account (.pem format). Must be set if
appidentity_email_address is set. (default: None)
ISTM that .pem is not necessary, but if it is, that is quite alright modified the milestones: This milestone has been deleted, This milestone has been deleted on Feb 9, 2015dhermes commented on Feb 21, 2016 ContributorAuthor More actions Played around a bit with this and the dev_appserver support is pretty bad. It doesn't support JSON keyfiles or P12 keyfiles, so a user has manually take one of them and extract the PEM contents of the key. Even still, after doing that, it only supports PEM PKCS#1 keys (BEGIN RSA PRIVATE KEY) while the keys in JSON keyfiles are PKCS#8 (BEGIN PRIVATE KEY). dhermes commented on Feb 21, 2016 ContributorAuthor More actions OK I was able to get it working with a JSON keyfile (H/T S/O), but I don't know if it's worth documenting since it is so broken difficult to use:
$ python
>>> import os
>>> JSON_CREDS = os.getenv('GOOGLE_APPLICATION_CREDENTIALS')
>>> JSON_CREDS
'/path/to/keyfile.json'
>>> import json
>>> with open(JSON_CREDS, 'rb') as fh:
... key_json = json.load(fh)
...
>>> pkcs8_pem = key_json['private_key']
>>> key_json['client_email']
'[email protected]'
>>> name, ext = os.path.splitext(JSON_CREDS)
>>> PEM_FILE = name + '-PKCS8.pem'
>>> with open(PEM_FILE, 'wb') as fh:
... fh.write(pkcs8_pem)
...
>>>
$ # Then convert to PKCS1
$ openssl rsa -in /path/to/keyfile-PKCS8.pem -out /path/to/keyfile-PKCS1.pem
and after doing this, the PKCS#1 PEM-file can be used:
$ dev_appserver.py \
> [email protected] \
> --appidentity_private_key_path=/path/to/keyfile-PKCS1.pem \
> ${APPLICATION_DIR}
Reacted by Surya Kasturi, Emmanuel Olowosulu, Mehmet Bora Ezer, Sam Brotherton, Kenji Imamula and Nicholas Austrom Reacted by Sam Brotherton dhermes commented on Feb 21, 2016 ContributorAuthor More actions @jgeewax Do you think this is worth adding to our auth doc or should I just give up on it and close out this issue? voscausa commented on Feb 22, 2016 Yes, because you do not have to store the key in your project. You can also use this setup to create signed urls to access Google Cloud storage in the development server using app_identity.sign blob() and the app default service account, without modifying your application. This default service account cannot be used as an ouath2client service account, because it does not have a client_id. dhermes commented on Feb 29, 2016 ContributorAuthor More actions dhermes commented on Mar 3, 2016 ContributorAuthor More actions dhermes commented on Mar 17, 2016 ContributorAuthor More actions lukesneeringer commented on Aug 11, 2017 Hello,
One of the challenges of maintaining a large open source project is that sometimes, you can bite off more than you can chew. As the lead maintainer of google-cloud-python, I can definitely say that I have let the issues here pile up.
As part of trying to get things under control (as well as to empower us to provide better customer service in the future), I am declaring a "bankruptcy" of sorts on many of the old issues, especially those likely to have been addressed or made obsolete by more recent updates.
My goal is to close stale issues whose relevance or solution is no longer immediately evident, and which appear to be of lower importance. I believe in good faith that this is one of those issues, but I am scanning quickly and may occasionally be wrong. If this is an issue of high importance, please comment here and we will reconsider. If this is an issue whose solution is trivial, please consider providing a pull request.
Thank you!
MetadataMetadatapriority: p2Moderately-important priority. Fix may not be included in next release. DevelopmentNo branches or pull requestsIssue actions
|