ClientLoginException from appcfg.sh - google-app-engine

I am attempting to upload a new version of a Google App Engine Application with appcfg.sh
upload but get the following exception:
com.google.appengine.tools.admin.ClientLoginServerConnection$ClientLoginException:
Email "...#gmail.com" and password do not match.
When prompted, I use the same Email address (...#gmail.com) and password that works just fine for logging into Google Developers Console e.g. using Safari.
Could this be a problem with my terminal settings? (I am using OS X Yosemite. If I type the password on the command line it appears as expected.)

I'd recommend the "password-less login with oauth2" explained at https://cloud.google.com/appengine/docs/python/tools/uploadinganapp#Python_Password-less_login_with_OAuth2 .
Just run appcfg.py --oauth2 with whatever command you require, and you'll be asked, once, to authorize your Google userid in your browser; then, the credentials are stored in file .appcfg_oauth2_tokens, and used thereafter. The page above goes into details about how to control the authorization process more finely, but, for me, the simple approach I'm summarizing here has been quite satisfactory.

Related

Where does Android Studio hide upload permissions for an app engine project?

I had a working app engine project (Java) which I had created from a template some time ago. The upload always worked fine and I don't remember that I had entered credentials when I set it up. Well, probably I did at some point, but I don't remember what the mechanism was.
Now I switched the project to another app engine project which also has a different admin user. I changed to the new application-name-000 in appengine-web.xml and started the upload, but gradle/appengineUpdate keeps telling me this:
Oct 20, 2014 10:06:35 AM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=application-name-000&version=2&
404 Not Found
This application does not exist (app_id=u'application-name-000').
Sure the application does not exist, because it's a new project for app engine ;-) I tried to set version 2 to version 1 temporarily which doesn't seem to be the problem. I googled and found out it seems to be a permission problem, but I can't find any hint what I need to do or where I can set the new permissions in Android Studio.
What is the process? Will I need to copy some key from app engine into the project, or where can I set my username/oauth whatever in Android Studio?
I finally found out how to fix this. And yes, it is a permissions problem (see proof further below).
Android Studio uses oauth to connect to the project to app engine. When you install Android Studio and then create the project the first time, it creates the following file in your home directory:
.appcfg_oauth2_tokens_java (in Windows this is under c:\Users\{Username}\)
This is a file with no name and just an extension. This file contains the token to connect and upload to app engine.
If the oauth user changes, Android Studio uses the wrong credentials and the upload fails.
To solve the problem:
Delete the file.
Call appengineUpdate from the command line (!), not from the menu (in Windows, you typically open the Terminal from within Android Studio and from within your module, then enter
..\gradlew appengineUpdate
It starts the update and due to the missing file, Android Studio pops open your browser where you select your Google user and give permissions. You then receive a code.
Copy that code and paste it into the Terminal. There is no input box or anything. The command line just stops and says nothing. Paste your code there and press enter.
A new file will then be created for you, the token saved to the file, and your project should upload fine.
The hint to the file I found here http://code.google.com/p/googleappengine/issues/detail?id=8300 and the hint how to copy the code was here http://code.google.com/p/qt-google-calendar/issues/detail?id=2 (awful, Google).
That it was a permissions problem could be seen, when I changed my build.gradle file:
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
}
oauth2 = true produced this error message:
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/create?app_id=...&version=2&
404 Not Found
This application does not exist (app_id=u'...').
while oauth2 = false produced this one:
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=...&version=2&
401 Unauthorized
Must authenticate first.
What do we learn? Never trust an error messages, no matter how explicit it seems to be.
You can simply change the password on the first account and when you try to run appengineUpdate it will prompt you for new account details.

Google_AuthException : invalid_grant

I'm trying to setup the config.php with my values but I get this fatal error:
Fatal error: Uncaught exception 'Google_AuthException' with message 'Error fetching OAuth2 access token, message: 'invalid_grant'.
I entered the client ID, secret, simple API key, location and sqlite database as the documentation says here:
https://developers.google.com/glass/quickstart/php
Any idea of what I'm doing wrong?
Thanks in advance!
This happens when the URL where you're hosting your Glassware is not listed as a valid OAuth 2.0 redirect URI on the API console. Follow these steps to resolve it.
First, determine your OAuth 2.0 redirect URI. This is where traffic goes at the end of the OAuth dance. The correct value depends on where you're running the php quick start. If you're running it on a local web server, it's likely to be http://localhost/mirror-quickstart-php/oauth2callback.php. If you're running it on example.com, it might be https://example.com/oauth2callback.php.
Go to the API console. This link will lead you to the right panel (services), but double check that you're on the correct project.
Scrolling down you should see a section of the page that looks like this: . Click on 'Edit Settings...'.
This triggers a pop-up where you can enter your OAuth redirect URIs. Add your redirect URI to the top text area. Make sure to put each URI on its own line.
Reload the page for the PHP Quick Start and everything should work.
If you're still having an issue, please share the full error message on the page and the value you have for the base url in config.php.
If you're getting the invalid_grant error from Google : Instead of using the client ID from google developer console as your value for client ID in the code, try using the email address value from developer console. This is actually what they expect. So, to confirm - the value for Client ID should be the value from developer console ending #developer.gserviceaccount.com
Had similar problem in Windows PS dotnet environment when trying to connect to DialogFlow Google Cloud Project recently and it appeared to be intermittent fault but it turned out to be global $env:GOOGLE_APPLICATION_CREDENTIALS in windows PowerShell was pointing to a key file set when first setup access to GCloud days before and since regenereated keys in GCP Console
After generating new key file and setting it with new generated key file using $env:GOOGLE_APPLICATION_CREDENTIALS="[Path_To_JSON_Key_File]" the problem went away but fix only lasted as long as the window was open, then after a while ran $env:GOOGLE_APPLICATION_CREDENTIALS on a newly opened PS window and noticed it was still pointing to the old key file!
setting the system environment variable GOOGLE_APPLICATION_CREDENTIALS to the value of [Path_To_JSON_New_Key_File] fixed it, all newly opened PS windows had the correct key file and authenticated correctly using Service Account and .Net Google Cloud API calls worked after that

bulkupload without username/password prompt

I have a process which generates daily some data, which I would like to update to a java app running on the appengine using bulkupload, using the command:
appcfg.py upload_data
--url=http://your_app_id.appspot.com/_ah/remote_api --kind= --filename=
It works perfectly, but it always asks me for my username/password.
Is there any way to save the credentials, use certificates, to avoid the username prompt?
Add these options:
--email=
--passin
and at the end : < "your password file.txt"
Seems this technique no longer works with SDK 1.9.17. The updated docs include some new oauth2 command line options, but the instructions are rather confusing. Anyone able to use either the old passin or the new oauth2 techniques? How?

302 status when copying data to another app in AppEngine

I'm trying to use the "Copy to another app" feature of AppEngine and keep getting an error:
Fetch to http://datastore-admin.moo.appspot.com/_ah/remote_api failed with status 302
This is for a Java app but I followed the instructions on setting up a default Python runtime.
I'm 95% sure it's an authentication issue and the call to remote_api is redirecting to the Google login page. Both apps use Google Apps as the authentication mechanism. I've also tried copying to and from a third app we have which uses Google Accounts for authentication.
Notes:
The user account I log in with is an Owner on all three apps. It's a Google Apps account (if that wasn't obvious).
I have a gmail account this is an Owner on all three apps as well. When I log in to the admin console with it, I don't see the datastore admin console at all when I click it.
I'm able to use the remote_api just fine from the command-line after I enter my details
Tried with both the Python remote_api built-in and the Java one.
I've found similar questions/blog posts about this, one of which required logging in from a browser, then manually submitting the ACSID cookie you get after that's done. Can't do that here, obviously.
OK, I think I got this working.
I'll refer to the two appIDs as "source" and "dest".
To enable datastore admin (as you know) you need to upload a Python project with the app.yaml and appengine_config.py files as described in the docs.
Either I misread the docs or there is an error. The "appID" inthe .yaml should be the app ID you are uploading to to enable DS admin.
The other appID in the appengine_config file, specifically this line:
remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (
'HTTP_X_APPENGINE_INBOUND_APPID', ['appID'])
Should be the appID of the "source", ID the app id of where the data is coming from in the DS copy operation.
I think this line is what allows the source appID to be authenticated as having permissions to write to the "dest" app ID.
So, I changed that .py, uploaded again to my "dest" app ID. To be sure I made this dummy python app as default and left it as that.
Then on the source app ID I tried the DS copy again, and all the copy jobs were kicked off OK - so it seems to have fixed it.

google app engine python uploading application first time

i'm trying to upload my app engine project for the very first time and i have no clue why it is not working. the error from my terminal is:
[me][~/Desktop]$ appcfg.py update ProjectDir/
Application: tacticalagentz; version: 1
Host: appengine.google.com
Starting update of app: tacticalagentz, version: 1
Scanning files on local disk.
Error 404: --- begin server output ---
This application does not exist (app_id=u'tacticalagentz').
--- end server output ---
i'm using python 2.6.5 and ubuntu 10.04.
not sure if this is relevant, but i just created a google app engine account today. and i also just created the application today (like a couple of hours ago). this is really frustrating because i just want to upload what i have so far (as a demo). in my app.yaml this is my first line:
application: tacticalagentz
Furthermore, i checked on my admin console, and i CLEARLY see the app id right there, and it matches letter for letter with the app id in my app.yaml
could someone please enlighten me and tell me what i am doing wrong? or is it something beyond my comprehension (like indexing issue with Google that they need time to index my app id) ?
thank you very much in advance
apparently adding the "--no_cookies" parameter will work
appcfg.py update --no_cookies ProjectDir/
the way i was able to find my answer was by uploading my app from my Mac OS X (thank god i have linux mac and windows). AppEngine on Mac OS X comes with a GUI interface, and it worked for uploading. so then i found the command they used in the console, which included "--no_cookies". perhaps if you run into similar issues in the future, this is one approach to getting the answer
App Engine for Java have the same problem. The problem is about account login.
If you are using Eclipse, use Sign In button.
If u are using command-line, use "-e" option, like this:
appcfg.sh -e your#email.com update yoursite/
I had the same problem. When I changed the name of the app I used in the launcher to match the one in the app engine, It worked without any problem. The way I figured out, it was the name mismatch which caused the problem. You can see the name of your registered app in the admin console of app engine.(https://appengine.google.com/)
Here's what fixed it for me:
i had an instance of dev_appserver.py myProjDirectory/ on a different terminal.
i guess the scripts are somehow linked and aren't thread safe
An alternate option that worked for me is to just "Clear Deployment Credential" from the Control option of the GUI. When the app was deployed after this, it opened a google page to allow GAE to access the user profile and then deployment was successful.
The key bit is
This application does not exist (app_id=u'tacticalagentz').
which is telling you that appspot.com doesn't know of an application by that name. The admin console (https://appengine.google.com/) shows your applications. Check there. You might have made an inadvertent typo when you registered the app.

Resources