Uh oh!
There was an error while loading. Please reload this page.
feat(platform): add organization parameter to OAuth authorization redirect - #550
Conversation
…irect Add optional `AIGNOSTICS_ORGANIZATION` environment variable that, when set, includes the `organization` parameter in the OAuth 2.0 PKCE authorization URL. This enables Auth0 organization-specific login flows in development and staging. - Add `organization: str | None` field to `Settings` - Conditionally include `organization` in `session.authorization_url()` params - Add unit test verifying the parameter is passed through the PKCE flow
There was a problem hiding this comment.
Pull request overview
Adds support for Auth0 organization-scoped interactive OAuth login by introducing an optional organization setting (via AIGNOSTICS_ORGANIZATION) and conditionally appending it to the PKCE authorization URL.
Changes:
- Add
organization: str | Noneto platform settings (env-backed via the existingAIGNOSTICS_prefix). - Update PKCE authorization URL construction to include
organizationwhen configured. - Add a unit test asserting the
organizationkwarg is passed toOAuth2Session.authorization_url.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/aignostics/platform/_settings.py | Introduces optional organization setting to control Auth0 org login behavior. |
src/aignostics/platform/_authentication.py | Conditionally includes organization in the authorization URL parameters for PKCE. |
tests/aignostics/platform/authentication_test.py | Adds coverage ensuring organization propagates into the authorization URL call. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests.
|
olivermeyer
commented
Apr 20, 2026
Thanks for the PR, some thoughts:
|
santi698
commented
Apr 20, 2026
I think you mean SPEC_PLATFORM_SERVICE.md |
olivermeyer
commented
Apr 20, 2026
You're right, seems like SPEC-APPLICATION-SERVICE only covers what happens once the token is acquired. So platform is the one 👍 |
santi698
commented
Apr 20, 2026
|
289fe59 to
c214653CompareUh oh!
There was an error while loading. Please reload this page.
c214653 to
ee93e37CompareUh oh!
There was an error while loading. Please reload this page.
ee93e37 to
a7dbf3aCompare…fication Add AIGNOSTICS_ORGANIZATION to the platform service specification: - Add organization parameter to Configuration Parameters (section 6.1) - Add AIGNOSTICS_ORGANIZATION environment variable (section 6.2) - Update PKCE Flow description to document organization parameter usage
a7dbf3a to
8c5a494CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Oliver Meyer <42039965+olivermeyer@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
tests/aignostics/platform/authentication_test.py:372
- In
_run_pkce_flow,AuthenticationResultis mocked withtokenpre-set to a non-None value. That means the success-path tests can pass even if the callback handler/server never sets the token (orhandle_request()is never called), which weakens the test and can mask regressions in the PKCE flow. Consider initializingmock_auth_result.tokentoNoneand having thehandle_requestside effect set it (mirroring what the realOAuthCallbackHandlerdoes), and/or assertingmock_server.handle_requestwas called.
mock_auth_result = MagicMock()
mock_auth_result.token = "pkce.token" # noqa: S105 - Test credential
mock_auth_result.error = None
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.



Summary
Add support for Auth0 organization-specific login flows via a new
AIGNOSTICS_ORGANIZATION_IDenvironment variable.When set, the
organizationparameter is included in the OAuth 2.0 PKCE authorization URL, enabling users to authenticate into a specific Auth0 organization (useful in development and staging environments).Changes
_settings.py: Addedorganization: str | Nonefield, configurable viaAIGNOSTICS_ORGANIZATION_IDenv var_authentication.py:_perform_authorization_code_with_pkce_flow()now conditionally addsorganizationto the authorization URL parametersauthentication_test.py: Added unit test verifying the organization parameter is correctly passed through the full PKCE flowUsage
Or via
.env:AIGNOSTICS_ORGANIZATION=my-org