fix: treat nil enabled_clients as enabled for all applications#1532
Open
davidlovas wants to merge 1 commit into
Open
fix: treat nil enabled_clients as enabled for all applications#1532davidlovas wants to merge 1 commit into
davidlovas wants to merge 1 commit into
Conversation
When enabled_clients is null in the API response (meaning the connection is enabled for all applications), GetEnabledClients() returns nil. len(nil) == 0 in Go, so the CLI incorrectly skips these connections, producing "no active database or passwordless connections" errors. This fix distinguishes between nil (all apps, no restriction) and an empty slice (explicitly disabled for all apps). Only the latter should be treated as disabled. Fixes all 3 occurrences in users.go: createUserCmd, importUsersCmd, and databaseAndPasswordlessConnectionOptions.
Open
6 tasks
Contributor
|
Hello @davidlovas , Thanks for raising the PR, We'll look into it and get back soon! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
auth0 users createfails with "There are currently no active database or passwordless connections to choose from" when a connection hasenabled_clients: null(the default, meaning enabled for all applications).Root cause
GetEnabledClients()returnsnilwhenenabled_clientsis null in the API response. In Go,len(nil) == 0evaluates totrue, so the CLI treats connections enabled for all apps identically to connections explicitly disabled (empty slice).Fix
Distinguish between
nil(all apps, no restriction) and empty slice (explicitly disabled):Applied to all 3 occurrences in
internal/cli/users.go:createUserCmd()(line 407)importUsersCmd()(line 897)databaseAndPasswordlessConnectionOptions()(line 999)Tested
Built the patched CLI locally and verified against a tenant with
enabled_clients: nullon theUsername-Password-Authenticationconnection:auth0 api post "users" --data '{...}'auth0 users create -c "Username-Password-Authentication" ...Same connection, same tenant — the Management API works, the
users createwrapper does not.Environment
Username-Password-Authenticationwithenabled_clients: null