-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DXCDT-340: Refactor API for test commands, fix bugs and improve DX #629
Conversation
064dc22
to
8516dc8
Compare
1b31632
to
127111c
Compare
// empty type means the default client that we shouldn't display. | ||
// Empty type means the default client that we shouldn't display. | ||
// TODO(sergiught): We only need to exclude generic app types for | ||
// the auth0 qs download command. Fix this in separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be fixed in a follow up PR after this one, so that we can select Generic type apps as well across the various commands and only discard Generic types for the quickstart download command.
client, err := cli.api.Client.Read(inputs.ClientID) | ||
if err != nil { | ||
return fmt.Errorf("Unable to find client %s; if you specified a client, please verify it exists, otherwise re-run the command", inputs.ClientID) | ||
if client.GetAppType() == appTypeNonInteractive { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't try to run a login for M2M app types but use the auth0 test token command instead for those.
@@ -157,46 +123,63 @@ func testLoginCmd(cli *cli) *cobra.Command { | |||
return nil | |||
} | |||
|
|||
if inputs.Audience != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regular Web Apps could be authorized to request access tokens for a specific API so if we do pass an audience we wanna make sure the application is authorized.
cli.renderer.Infof("Domain: " + tenant.Domain) | ||
cli.renderer.Infof("ClientID: " + inputs.ClientID) | ||
cli.renderer.Infof("Type: " + appType + "\n") | ||
cli.renderer.Infof("Domain : " + ansi.Blue(tenant.Domain)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a bit of color into our lives.
tokenResponse, err := runLoginFlow( | ||
cli, | ||
tenant, | ||
client, | ||
inputs.ConnectionName, | ||
inputs.Audience, // audience is only supported for the test token command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message that audience wasn't supported was flawed.
if isTemp { | ||
if err := cli.api.Client.Delete(id); err != nil { | ||
cli.renderer.Errorf("unable to remove the default test application", err.Error()) | ||
func selectClientToUseForTestsAndValidateExistence(cli *cli, cmd *cobra.Command, args []string, inputs *testCmdInputs) (*management.Client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shared logic between both test commands, we select an existing client ID or choose to create one for the test.
2b6d317
to
48daa25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid DX upgrade 👍
🔧 Changes
In this PR we're aiming at offering a more cohesive experience for the
auth0 test login
andauth0 test token
commands.Summary of changes:
--connection
to--connection-name
inauth0 test login
command (d1ac562)--client-id
from a flag to an argument inauth0 test token
command (e958077)b2a91c3
,e958077
)📚 References
🔬 Testing
📝 Checklist