auth0 / auth0-cli

Build, manage and test your Auth0 integrations from the command line
https://auth0.github.io/auth0-cli/
MIT License
243 stars 52 forks source link

Unable to create an access token on Gitpod.io with the Auth0 CLI #965

Open mraible opened 7 months ago

mraible commented 7 months ago

Checklist

Description

I've started playing with Gitpod.io as a solution for our workshops. It's pretty awesome because SDKMAN and Homebrew are pre-installed, so I can easily install Java 21, the Auth0 CLI, and HTTPie. However, I'm having issues creating an access token using auth0 test token. auth0 login opens a text-based browser and is a real pain when you have MFA configured. auth0 login --no-input is a workaround.

The following will invoke a terminal browser, and you'll be stuck waiting for nothing to happen.

auth0 test token -a https://dev-06bzs1cu.us.auth0.com/api/v2/ -s opened

If you specify a client ID and --no-input, you can get a bit further with:

auth0 test token r6jm3HVTz12YmxRCdZ1rWTZNQST7gEvz -a https://dev-06bzs1cu.us.auth0.com/api/v2/ -s openid --no-input

This prompts you to open https://dev-06bzs1cu.us.auth0.com/authorize?audience=https%3A%2F%2Fdev-06bzs1cu.us.auth0.com%2Fapi%2Fv2%2F&client_id=r6jm3HVTz12YmxRCdZ1rWTZNQST7gEvz&redirect_uri=http%3A%2F%2Flocalhost%3A8484&response_type=code&scope=openid&state=UKRkmyGaMjvFRPuDlfuCGtKH8oDfC_mdmlOH8SmyAyDLM9Sfb24JSsqAx3_pIUkW__bq2imcJKi6dim57l2DKg.

If you change the redirect to go back to Gitpod, instead of localhost, it works. However, the Auth0 CLI is no longer running a server on port 8484 anymore.

It'd be cool if auth0 test token could somehow work like auth0 login --no-input where you can log in in a local browser window.

Here's a repo you can use to test things out. Just click on the Open in Gitpod button.

https://github.com/mraible/gitpod-java

Expectation

I'd like to be able to use auth0 test token and get an access token from a Gitpod shell.

Reproduction

Here's a repo you can use to test things out. Just click on the Open in Gitpod button.

https://github.com/mraible/gitpod-java

Then, run auth0 login --no-input to configure the CLI with your tenant. Then, try to create an access token.

Auth0 CLI version

1.3.0