auth0 / auth0-cli

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

`auth0 login` should respect the `--domain` flag for personal credentials login #1000

Open davidharrigan opened 4 months ago

davidharrigan commented 4 months ago

Checklist

Describe the problem you'd like to have solved

My Auth0 account has many tenants. Selecting the correct tenant from the authorization consent UI is doable, but would be nice if the auth0 login --domain <tenant domain> worked for the device code flow login.

Describe the ideal solution

When --domain flag is provided for the device code login flow, the correct tenant is selected without having to search for it in the UI.

Alternatives and current workarounds

No response

Additional context

I believe this would work if we can pass the --domain value to the audience field here: https://github.com/auth0/auth0-cli/blob/54e9a30eeb58a4a7e40e04dc19af6869036bfb32/internal/auth/auth.go#L153 instead of using the hardcoded wildcard audience defined here: https://github.com/auth0/auth0-cli/blob/54e9a30eeb58a4a7e40e04dc19af6869036bfb32/internal/auth/auth.go#L53

duedares-rvj commented 1 month ago

@davidharrigan Thank you David for the recommendation. We have updated the login flow to respect the domain flag now. Please note that since domain is a common param used by both machine login and user login, one should use the below command to login to a tenant directly in a user login flow:

auth0 login --domain <tenant domain> --no-input

The no-input flag indicates that there will be no further input (client-id and client-secret) and hence cli evaluates it as a user login flow.

This shall be included in the next upcoming release.

davidharrigan commented 1 month ago

thank you, looking forward to the next release :)