Skip to content

[Portal] Expose generated auth flows - #5995

Open
fungc-io wants to merge 2 commits into
authgear:mainfrom
fungc-io:generated-auth-flows
Open

fungc-io wants to merge 2 commits into
authgear:mainfrom
fungc-io:generated-auth-flows

Conversation

@fungc-io

Copy link
Copy Markdown
Member

ref DEV-3921

The upcoming flow builder needs the flows Authgear generates from a project's settings, so "Start from my current settings" can turn them into an editable custom flow. Reading and saving flows otherwise uses the existing updateApp path.

Changes

App.generatedAuthenticationFlows: AuthenticationFlowConfig! (portal GraphQL)

  • One flow named default per type: signup, promote, login, signup_login, reauth, account recovery.
  • Same shape as the authentication_flow section of authgear.yaml.
  • Computed from the app's effective config (feature constraints applied), the same input the auth server uses, so it matches what end-users get.

Passkey in signup_login no longer requires signup_flow

The generator gives the passkey option a login_flow only, since an account cannot be created with a passkey. The schema required signup_flow on every option except select_account, so a passkey project's generated flow failed validation when saved as a custom flow. The runtime only reads signup_flow for login ID, OAuth, and LDAP options. This accepts more config than before, so it is not breaking.

Known gap

A project without an email or phone login ID gets an account recovery flow with no options. It is returned as generated; saved as a custom flow it fails validation. The builder will flag it (DEV-3935).

Tests

  • generate_config_test.go: for four settings combinations (defaults; phone + SMS OTP; username + password + required 2FA; email + passkey + Google), the generated flows saved back as custom flows pass config.Parse. The username case asserts the account recovery error above.
  • signup_login_flow_tests.yaml: passkey without signup_flow (valid), with both (valid), without login_flow (invalid).

The generated signup_login flow gives the passkey option a login_flow
only, since an account cannot be created with a passkey, but the schema
required signup_flow on every option except select_account. Saving the
generated flow as a custom flow therefore failed validation. The
runtime never reads signup_flow for passkey.

ref DEV-3921
Add App.generatedAuthenticationFlows, the flow of each type that
Authgear generates from the app's settings, in the shape of the
authentication_flow config section. The flow builder uses it to start
a custom flow from the current settings.

ref DEV-3921
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant