auth0-cli icon indicating copy to clipboard operation
auth0-cli copied to clipboard

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

Open mraible opened this issue 5 months ago • 0 comments

Checklist

  • [X] I have looked into the README and have not found a suitable solution or answer.
  • [X] I have looked into the documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have upgraded to the latest version of this project and the issue still persists.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

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

mraible avatar Jan 17 '24 14:01 mraible