Вопрос

I configured OAuth for one account I have, my.first.email@gmail.com. It works perfectly with Appengine app_ids I'm using for that account.

Once I try to use it on an application 'foo' for another account (say my.second.email@gmail.com), though, the system gives me an error (quite expectedly):

$ appcfg.py --oauth2 update .
10:09 AM Host: appengine.google.com
10:09 AM Application: foo; version: 100
10:09 AM Starting update of app: foo, version: 100
10:09 AM Getting current resource limits.
10:09 AM Scanning files on local disk.
Error 404: --- begin server output ---
This application does not exist (app_id=u'foo').

Is it possible to use OAuth for TWO (or more) accounts with App Engine? I'd like to be able to use OAuth at the same time for both accounts, maybe changing the CLI command with two different tokens.

Thanks, Riccardo

Это было полезно?

Решение 2

Use the gcloud command to change between multiple accounts.

Adding a new account:

gcloud auth login

complete the login process

Setting above account as default(or simply switching accounts):

 gcloud config set account username@gmail.com

Другие советы

Try this secret command line option to appcfg.py:

appcfg.py --oauth2 --oauth2_credential_file=~/.appcfg_oauth2_tokens_personal update .

Found this option by looking at /usr/local/google_appengine/google/appengine/tools/appcfg.py. This should allow you to use different credential files for your different accounts, you may want to alias the command to make it easy to type in your shell.

To build on @Ryu_hayabusa's suggestion, add this to your .bashrc or .bash_profile for more convenient switching between accounts:

function gcauth() { email="$@"; gcloud config set account $email; echo "Updated GCloud auth to $email"; }

# set up functions for specific email addresses:
function gcwork() { gcauth work@email.com; }
function gcperso() { gcauth personal@email.com; }

Then you can switch between a work and personal account very easily, for example:

$ gcwork
Updated GCloud auth to work@email.com
$ gcperso
Updated GCloud auth to personal@email.com

If you want to shift from client login(which is permanently deprecated now) just update with --oauth2 and your application will be deployed-

python appcfg.py update --oauth2 /path/to/app

Using client login will give you the following error- Error 404: --- begin server output --- https://developers.google.com/accounts/docs/AuthForInstalledApps --- end server output ---

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top