Conversation
IamJeffG
force-pushed
the
157-wizard-auth0
branch
2 times, most recently
from
September 21, 2026 17:17
f4ec3c5 to
1aa5059
Compare
Idempotent ensure_* functions (google-oauth2 connection, per-app clients, M2M metrics client, Management API grants, RBAC roles, Post-Login Actions) built on the classic pre-5.0 auth0-python surface. Each lists existing resources and matches by name before upserting.
Also drops a defensive filter in ensure_post_login_actions that guarded against a binding missing its "action" dict key -- no longer possible now that every listed binding is a typed ActionBinding.
IamJeffG
force-pushed
the
157-wizard-auth0
branch
from
September 21, 2026 17:18
1aa5059 to
f5d8783
Compare
...even though there's no stack.yaml field for it. The consumer will log its id & secret instead.
IamJeffG
added this pull request to stack #181
September 23, 2026 22:29
IamJeffG
marked this pull request as ready for review
September 24, 2026 01:23
conservationtimothy
requested changes
Sep 24, 2026
| logger.info(f"Creating Post-Login Action {name!r}") | ||
| action = mgmt.actions.create(name=name, **fields) | ||
|
|
||
| mgmt.actions.deploy(action.id) |
Contributor
There was a problem hiding this comment.
deploy can return before the action version has finished building. Since ensure_post_login_actions binds immediately after both deploy calls, this could intermittently fail with Auth0 reporting that the action has not been deployed yet.
The current tests don’t catch this because mgmt is mocked and deploy returns immediately. We should wait until each action version is built before calling update_many.
Auth0 also documented this issue in 2025: https://support.auth0.com/center/s/article/Trying-to-create-a-binding-for-an-action-that-has-not-been-deployed-yet
This branch has not been deployed
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.
Goal
Automate Auth0 setup in order to speed deploying the Guardian Connector stack. This includes:
This PR adds code that talks directly to the Auth0 Management API, instead of requiring the human operator to click through Auth0's web portal by hand. It automates most of the steps already documented in
auth0/README.md.PR Stack
This PR is the first of two in a stack:
gc-stack-deploy wizardsubcommand.What I changed and why
This PR is pure auth0 client library code. Not yet exposed on the CLI or TUI.
Note that a prerequisite for all this is a human operator still must manually create the Auth0 Tenant and an M2M ("Machine-to-Machine") app in the Auth0 portal.
gc-stack-deployis the M2M app; this M2M app will be used only to bootstrap the rest of the Auth0 tenant, and then it'll never be used again after deployment.This PR adds two just 2 Python modules (and tests):
wizard/auth0/client.py: very thinly wrapsauth0-python.GetToken, callsclient_credentials`)find_by_namelists everything and matches client-side.wizard/auth0/provisioning.py: declarativeensure_*functions, one for each resource type we want to ensure got created:find_by_namehelper, and updates-or-creates (idempotent).client_secreton the create response, but not on later reads. Soensure_clienttakes anexisting_secretparam so a caller can pass through a secret already known from the targetstack.yaml, and returnsNone(with a warning) when no secret is known.Note that auth0 clients for GC Metrics and Windmill are created even though there's no field for them in stack.yaml. Their ID and secrets simply get logged for the operator to write down for later.
Note for reviewers
Half the diff is tests. The reason
provisioning.pyis so long is because it's pretty much enumerating a slew bunch of business rules. It's the number of business rules that drives the size of this PR.What I'm not doing here
I think there may be a mismatch in role names given in the documentation:
gc-deploy/auth0/README.md
Line 112 in 99c86f2
vs
gc-deploy/auth0/README.md
Lines 136 to 140 in 99c86f2
In this PR I used the latter list:
GuestandSignedIn. But have not (yet) fixed the mismatch until @rudokemper confirms it is incorrect and I'm keeping the right one.LLM use disclosure
Written almost entirely in claude code, including the plan and code. I reviewed the plan and made many iterations of the code. I reviewed the my code to my satisfaction, including minor edits myself.