How to generating user token with auth0 test token

Hi, i’m trying to generate a user token using the auth0 cli and i’m struggling to move forward
i’m trying to get a token with the fallowing command:

auth0 test token client_id1 --audience "<audience>" --tenant "<tenant>.eu.auth0.com" --scopes "s1, s2, s3, s4"

and i get the following error:
Failed to log into the client with ID "client_id1": invalid_request: parameter organization is required for this client.
looking at the documentation and --help there is no organization parameter, how should htis be supplied

1 Like

Hi @alex529,

Welcome to the Auth0 Community!

You can get the list of organizations using the Auth0 CLI by calling auth0 orgs list.

Reference: auth0 orgs | Auth0 CLI

Thanks,
Rueben

my problem is not how to get the organization, my problem is how to pass the organization to to the auth0 test token command so i can generate a token

Hi @alex529,

You should be able to select your organization from the organization picker during the login flow if you have configured it on your application settings.

To verify, please go to your application settings > organizations > login flow and select Prompt for Credentials.

image

Thanks,
Rueben

Wouldn’t this change the login workflow for all users, no mater how they will login(cli or not)?
I’m interested in a solution that impacts only myself while on the cli.

Hi @alex529,

I was not able to reproduce the same error you observed. I have just tested the Auth0 CLI on my end with the following command:
auth0 test token <client_id> -a <audience> -s <scopes>
And did not have any issues.

Have you made sure you are using the latest version (Auth0 CLI - Github)?

here is the printout from the console, i’ve re run the install again:

~/proj >go install github.com/auth0/auth0-cli/cmd/auth0@latest
~/proj >auth0 test token ******************************** --audience "*****************************" --tenant *********************** --scopes "***********, ***********, **********, **********"
 ▸    Domain    : ***********************
 ▸    Client ID : ********************************
 ▸    Type      : Single Page Web Application

 ▸    A browser window needs to be opened to complete this client's login flow.
 ▸    Once login is complete, you can return to the CLI to view user profile information and tokens.
 Do you wish to proceed? Yes
 Do you wish to proceed? (y/N) y
Waiting for login flow to complete... failed

=== *********************** error

 ▸    Failed to log into the client with ID "********************************": invalid_request: parameter organization is required for this client.

and this is the screenshot from the browser:


the application accepts Business users, and the login flow is se to Prompt for organization
when i do auth0 login i can manage to login, i just can’t manage to generate a token for the application

@rueben.tiow any insights, if this can be fixed or if there is something wrong with my setup/flow

Hi @alex529,

Thanks for your updates.

Could you try creating a new application and trying to login with the client ID?

This test can help us determine if your application in your initial test does require an organization parameter.

Thanks,
Rueben

if i “clone” the application with the exact settings i have the same outcome

Hi @alex529,

Can you share what specific settings you used for your newly created tenant?

Thank you,
Rueben