flank icon indicating copy to clipboard operation
flank copied to clipboard

FetchArtifacts Exception - rewrite user auth flow

Open gtroshin opened this issue 7 years ago • 8 comments

java -jar ./flank.jar -v
v4.2.0
5148c339e697778a3714bfb1aa6d4a9a120c5164

There is a failure in the end of test.

FetchArtifacts
  Exception in thread "main" picocli.CommandLine$ExecutionException: Error while running command (ftl.cli.firebase.test.ios.IosRunCommand@767599a7): com.google.cloud.storage.StorageException: java.lang.IllegalStateException: OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing.
	at picocli.CommandLine.execute(CommandLine.java:1168)
	at picocli.CommandLine.access$800(CommandLine.java:141)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:1367)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:1335)
	at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1243)
	at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526)
	at picocli.CommandLine.run(CommandLine.java:1974)
	at picocli.CommandLine.run(CommandLine.java:1920)
	at ftl.Main$Companion.main(Main.kt:48)
	at ftl.Main.main(Main.kt)
Caused by: com.google.cloud.storage.StorageException: java.lang.IllegalStateException: OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing.

gtroshin avatar Jan 17 '19 14:01 gtroshin

Are you using a service account JSON for authorization?

bootstraponline avatar Jan 17 '19 15:01 bootstraponline

@bootstraponline

Are you using a service account JSON for authorization?

yes I do

gtroshin avatar Jan 17 '19 15:01 gtroshin

Thanks. I'll track down this bug

bootstraponline avatar Jan 17 '19 15:01 bootstraponline

This looks like it'll be fun to solve. 😭

https://github.com/googleapis/oauth2client/issues/391

The underlying auth lib needs to be replaced:

https://google-auth.readthedocs.io/en/latest/oauth2client-deprecation.html

bootstraponline avatar Jan 17 '19 16:01 bootstraponline

I pushed a hotfix that solves the issue by disabling user auth. Service account auth now won't expire. You can use the snapshot jar which is auto published after every PR.

  • https://github.com/TestArmada/flank/releases/tag/flank_snapshot

At some point in the future I'll update to the new non-deprecated oauth lib and that will enable supporting user auth in addition to service auth. I'll leave this issue open until then.

bootstraponline avatar Jan 17 '19 16:01 bootstraponline

Thanks for the fix! I am testing it now.

gtroshin avatar Jan 18 '19 10:01 gtroshin

Seems like that issue is gone. Thanks again.

gtroshin avatar Jan 18 '19 12:01 gtroshin

Authentication now uses the latest Java lib by Google.

bootstraponline avatar Feb 23 '19 02:02 bootstraponline