2

I am trying to deploy a basic app engine web app with maven.

As a part of the deployment process, I am required to authenticate via a web browser.

I am using 2 different google accounts. 1 for home. 1 for work. When maven opened up the browser tab to ask me to authenticate, it selected the wrong account. I didn't notice this and clicked the "Allow" button.

enter image description here

This account does not have the right credentials so I got an access denied error.

   >mvn appengine:update
...

Beginning interaction for module default...
Apr 01, 2016 4:47:32 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #0
Apr 01, 2016 4:47:32 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #1
Apr 01, 2016 4:47:32 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #2
Apr 01, 2016 4:47:33 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #3

So I think "no biggee", I'll just run it again. Somehow I'll get maven to select the correct account (maybe I'll temporarily logout of the incorrect one) and that will solve the problem.

Unfortunately, I am no longer being prompted to authenticate. It just keeps giving me accessed denied errors.

I am presuming there is a file somewhere on the file system that I need to delete in order to get prompted for my authorization again.

Does anyone know where this file is?

UPDATE

I tried completely recreating my project from scratch in a different directory, and I still get the access denied errors.

By running this command ...

mvn help:describe -Dplugin=appengine -Ddetail 

I have discovered that there is an additional parameter that I can pass to the update goal that will do exactly what I need it to do, but I don't know how the correct syntax to use to actually pass this additional parameter.

appengine:update

Description: Create or update an app version.
Implementation: com.google.appengine.appcfg.Update Language: java
Before this mojo executes, it will call: Phase: 'package'

Available parameters:

additionalParams
  User property: appengine.additionalParams
  Additional parameters to pass through to AppCfg.

noCookies
  User property: appengine.noCookies
  Do not save/load access credentials to/from disk.

I think this might be the correct syntax ...

    >mvn appengine:update -DadditionalParams="--noCookies"

However, this does NOT solve the problem as the update seems to ignore the parameter.

Alex Ryan
  • 3,719
  • 5
  • 25
  • 41

2 Answers2

6

I fixed the error using this command before mvn appengine:update command:

rm ~/.appcfg_oauth2_tokens_java

EhsanR
  • 467
  • 7
  • 17
  • Behind the scene the maven appengine plugin use the gcloud CLI. I was logged with the very same user that first get the 403. Using your trick fixed the problem but it's strange though... – chaiyachaiya Mar 26 '17 at 17:44
1

I was able to solve this problem by using the appcfg.sh tool instead of maven.

    >appcfg.sh --no_cookies update /path/to/maven/project/first_project_second_try/guestbook/target/guestbook-1.0-SNAPSHOT

I suspect that it is possible to do this with maven as well, but I am uncertain as to how pass the "--no_cookies" option to maven.

Alex Ryan
  • 3,719
  • 5
  • 25
  • 41