You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to implement a social login flow (Google, Discord, GitHub) with the following requirements:
New users see an approval message - When users log in for the first time via social login, they should see a friendly message explaining their account is pending administrator approval
Users are created as inactive - New users should be created but not able to access applications until an admin activates them
Source connection must work - After activation, users should be able to log in again without getting "username already taken" errors
Only approved users get access - Users should only access applications (e.g., Nextcloud) after being added to specific groups
The UserSourceConnection is not created during enrollment. This causes:
Second login attempt triggers enrollment flow again instead of authentication flow
"Username already taken" error because user already exists
2. Inactive Users Can Still Login
When using user_type: external:
Source connection IS created correctly
But inactive users can still authenticate and reach applications
The is_active flag doesn't block external users from logging in
3. Missing Email in Flow Context
Initially got errors like 'email' when the User Write Stage tried to create the user because:
Google doesn't provide a username automatically
Email wasn't present in the prompt_data context
Needed to add an email field to the Prompt Stage
4. Policy Binding Confusion
Validation Policies on Prompt Stages don't have access to social login data
Policies need to be bound to Stage Bindings, not to the Stage itself
This differs from how the default enrollment flow works
Current Flow Structure
Order -10: Invitation Stage (continue without invitation)
Order 0: Prompt Stage (username + email fields)
Order 10: User Write Stage (create_users_as_inactive=true, user_type=internal)
Order 20: Deny Stage (approval message in German/English)
Questions
What's the recommended way to implement this approval workflow? Should I:
Use user_type: external + policy on authentication flow to block inactive users?
Use user_type: internal + manual source connection after activation?
Use active users with group-based application policies instead?
How does the UserSourceConnection get created for internal users? Is there a stage or setting I'm missing?
Should the enrollment flow handle source connection differently when create_users_as_inactive is used?
Is there a better pattern for "pending approval" workflows with social login that I should be following?
What I've Tried
Custom enrollment flow with internal user type (source connection not created)
External user type (inactive users can still login)
Various policy configurations on flows and stages
Adding email field to prompt stage to fix context issues
Additional Context
The default default-source-enrollment flow works well for active users but doesn't support:
Creating inactive users
Showing custom approval messages
Preventing access until admin approval
Any guidance on the correct approach would be greatly appreciated!
This discussion was converted from issue #17239 on October 07, 2025 01:46.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Goal
I want to implement a social login flow (Google, Discord, GitHub) with the following requirements:
Current Setup
social-login-with-approvalProblems Encountered
1. Source Connection Not Created
When using a User Write Stage with:
user_type: internalcreate_users_as_inactive: trueThe UserSourceConnection is not created during enrollment. This causes:
2. Inactive Users Can Still Login
When using
user_type: external:is_activeflag doesn't block external users from logging in3. Missing Email in Flow Context
Initially got errors like
'email'when the User Write Stage tried to create the user because:prompt_datacontext4. Policy Binding Confusion
Current Flow Structure
Questions
What's the recommended way to implement this approval workflow? Should I:
user_type: external+ policy on authentication flow to block inactive users?user_type: internal+ manual source connection after activation?How does the UserSourceConnection get created for internal users? Is there a stage or setting I'm missing?
Should the enrollment flow handle source connection differently when
create_users_as_inactiveis used?Is there a better pattern for "pending approval" workflows with social login that I should be following?
What I've Tried
Additional Context
The default
default-source-enrollmentflow works well for active users but doesn't support:Any guidance on the correct approach would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions