Group Selection
Overview
Group selection is a functionality offered by cidaas that gives users the ability to choose the configured groups with which they want to interact with cidaas. When group selection is activated, users are prompted to decide which group they wish to engage with.
Upon activation, the user is presented with a list of existing groups, and they are prompted to select the relevant group. If the chosen group is part of the configured list, this selection is then incorporated into the access token, providing a way to carry context-specific information throughout their interaction with the system.
Introduction to Groups Selection
What are groups?
Groups play a role in managing users based on roles or attributes. Users can be organized into groups, each representing a specific role or level of access. They define broader categories of users, each with its own set of permissions.
For example:
A Group_A that has Admins rights will have access to system functionalities.
A Group_B that has Users rights will have limited access with fewer privileges.
Prerequisites
- User must have multiple groups: Users need to be assigned to multiple groups for group selection to be meaningful. If a user only has one group, no selection prompt will appear.
How to Configure Group Selection
Group selection is set up in two places: first you create a reusable Group Selection configuration, then you assign it to your application. Follow these steps:
Configuration Options
These options belong to the Group Selection configuration (Permission Setup → Group Selection), shown above.
Behavior: When enabled, users with multiple groups are prompted to select a group during authentication.
Behavior: Does not show the screen for a single selectable group — that group is applied automatically. The screen appears only when more than one selectable group applies.
Use case: Re-evaluate group context on renew when multiple selectable groups exist.
Behavior: Users only see groups specified in the 'selectable groups' settings.
Use case: Limit login access to specific groups only.
Behavior: Users can select from all groups of a specific type during login.
Use case: Organize groups by categories (e.g., department, location, role_type).
Assign the configuration to your application
Creating the configuration does not activate it on its own — you must assign it to each application that should use it. Open the application under Integrations → Applications, go to the Authentication Setup tile, and select your Group Selection configuration under the Group Selection label.
When is Group Selection Shown to Users?
The selection screen appears only when the user has more than one selectable group for the application.
| Condition | What happens |
|---|---|
| More than one selectable group | Selection screen is shown |
| Exactly one selectable group | That group is applied automatically — no screen, including when always-show is on or the request has prompt=select_group |
| Zero selectable groups | No selection step |
Always-show and prompt=select_group do not force a screen for a single selectable group. On renew, they only block silent reuse of the previous group when that renew auto-pass path would otherwise apply. After that, the same count rules above decide whether a screen is shown.
Other cases that can lead to a screen (still only when more than one selectable group remains):
| Situation | Effect |
|---|---|
| Previous group no longer selectable | Renew auto-pass is skipped; if more than one selectable group remains, the screen is shown |
| No previous selection and multiple selectable groups | Screen is shown |
Valid group_hint | Hinted group is applied with no screen when it is selectable (see below) |
group_hint in the authorization request to pre-select a group and skip the selection UI. See How to Auto-Select a Group Using the group_hint Parameter.Group Selection Behavior
cidaas provides group selection functionality with intelligent group validation and client-initiated selection prompts.
Key Features
prompt=select_group so renew does not silently reuse the previous group. The screen still appears only when more than one selectable group applies.Group Validation Logic
The system validates if a previously selected group is still applicable for the current application:
Validation Flow:
IF user has a previously selected group:
AND group selection is configured for current app:
IF previous group is in current app's selectable groups:
→ Use previous group (no prompt)
ELSE:
→ Force new group selection
ELSE (no group selection configured):
→ Remove group from token
Validation Criteria:
A previous group is considered still selectable if:
- The group ID exists in the current app's
SelectableGroupslist, OR - The group type exists in the current app's
SelectableGroupTypeslist
How to Enforce Group Selection
Method 1: Using Always Show Group Selection Setting
Enable Always Show Group Selection on Login in the Group Selection configuration (Permission Setup → Group Selection), then assign that configuration to your application. On renew, this blocks silent reuse of the previous group. The selection screen still appears only when the user has more than one selectable group; a single selectable group is applied with no screen.
Method 2: Using Prompt Parameter in Authorization Request
Clients can include prompt=select_group in the authorization request so renew does not silently reuse the previous group:
GET /authz-srv/authz?
response_type=code&
prompt=select_group&
client_id=your_client_id&
redirect_uri=your_redirect_uri&
scope=openid
Behavior with Prompt Parameter:
- Overrides renew auto-pass: Token renewals do not reuse the previous group silently
- Screen still needs multiple groups: The UI appears only when more than one selectable group applies
- Respects app configuration: Only works if group selection is configured for the application
- Use Case: Lets applications re-evaluate group context on demand when multiple selectable groups exist
Example Use Case:
- User is logged in with "Marketing Team" group and also has "Engineering Team" as selectable
- User navigates to a page where they want to switch to "Engineering Team"
- Application redirects to authorization endpoint with
prompt=select_group - Because more than one selectable group applies, the user is prompted and can switch context
Behavior with prompt=none
When a client uses prompt=none in the authorization request, the system attempts to authenticate without any user interaction. However, if group selection is required (due to app configuration or invalid previous group), the authorization request will fail with an interaction_required error.
Example:
GET /authz-srv/authz?
response_type=code&
prompt=none&
client_id=your_client_id&
redirect_uri=your_redirect_uri
Response when group selection is required:
{
"error": "interaction_required",
"error_description": "group_selection_required"
}
Use Case:
This is useful for silent authentication flows (e.g., iframe-based SSO checks) where you want to detect if user interaction is needed. If interaction_required is returned, the client should redirect to the authorization endpoint without prompt=none to allow the user to select a group.
When Groups are Removed from Tokens
Groups are removed from tokens when:
- No group selection is configured for the current application
- Previously selected group is invalid and no new selection is made
Token Renewal Behavior
For token renewals:
- Previous group reused only when
alwaysShowGroupSelectionis present andfalse,prompt=select_groupis absent, andgroup_hintis empty or equal to that group - Omitted
alwaysShowGroupSelection: Previous group is not reused (same as blocking renew auto-pass) alwaysShowGroupSelection: trueorprompt=select_group: Previous group is not reused silently; screen still only when more than one selectable group applies- With invalid previous group: Renew auto-pass is skipped; screen appears only if more than one selectable group remains
- Valid
group_hintthat differs from previous: Hinted group is applied with no screen - No group selection configured: Remove groups from token
User Experience Scenarios
-
Scenario 1: Valid Previous Group
User Context: Previously selected "Marketing Team" groupCurrent App: Has "Marketing Team" in selectable groupsResult: Token renewed with "Marketing Team" (no prompt) -
Scenario 2: Invalid Previous Group
User Context: Previously selected "Sales Team" groupCurrent App: Only allows "Engineering Team" and "Marketing Team"Result: User prompted to select from available groups (more than one selectable) -
Scenario 3: Client blocks renew auto-pass
User Context: Valid previous group exists; more than one selectable groupClient Request: Includes prompt=select_groupResult: User prompted for group selection (previous group not reused silently) -
Scenario 4: No Group Selection Configured
User Context: Previously selected "Marketing Team" groupCurrent App: No group selection configuredResult: Group removed from token, no prompt shown
How to Auto-Select a Group Using the group_hint Parameter
The group_hint parameter lets a client pre-select a group so the selection UI is skipped whenever the hint is selectable. prompt=select_group is the opposite for renew auto-pass: it blocks silent reuse of the previous group, but it still does not show a screen when only one selectable group applies.
Clients can pass the preferred group ID as the group_hint parameter in the authorization request:
GET /authz-srv/authz?
response_type=code&
client_id=your_client_id&
redirect_uri=your_redirect_uri&
scope=openid&
group_hint=Group_A
Behavior with group_hint:
- Auto-selects when valid: If the hinted group ID is one of the user's selectable groups for the current application, that group is automatically selected, no group selection UI is shown, and the group is added to the access token.
- Falls back gracefully when invalid: If the hinted group ID is not a selectable group for the user, the hint is ignored and the standard group selection behavior applies (the user is prompted only when multiple selectable groups exist).
- No effect when group selection is disabled: If group selection is not enabled for the application, the
group_hintvalue is accepted but has no effect on the flow.
Behavior during token renewal:
- Matches previous group: If
group_hintmatches the previously selected group and that group is still selectable, it is reused and no prompt is shown. - Differs from previous group: If
group_hintis valid and differs from the previously selected group, the hinted group is applied with no screen. If the hint is not selectable, standard count rules apply (screen only when more than one selectable group remains).
Example Use Case:
- An application always operates in the context of a specific group (e.g., a tenant- or department-specific portal).
- The application includes
group_hint=Group_Ain the authorization request. - The user is logged in directly with
Group_Awithout seeing the group selection screen.
group_hint to pre-select a group and skip the screen. Use prompt=select_group when you do not want renew to reuse the previous group silently. Neither shows a screen for a single selectable group.Understanding the Flow and APIs
Step 1: Rendering to the User Verification Methods
Before initiating password authentication, you will perform an Authorization (Authz) call and use the requestId in the upcoming calls.
The first call will be to get the configured verification methods for a user. Based on the response you provide a selection of verification methods for your user. A demo of how this can look is to present different icons:
Request
curl --location '{base_url}/verification-srv/public/graph/user/setup' \
--header 'content-type: application/json' \
--data-raw '{
"request_id": "{{requestId}}",
"identifier": "{{email}}"
}'
This public login list is for choosing how to authenticate (request_id + identifier). It is not the profile API for listing or removing enrollments.
For a signed-in self-service profile (display, then delete TOTP / SMS / a single passkey), use GET /verification-actions-srv/users/configurations and the matching DELETE routes. See List configured verification methods.
The response contains the list of all verification methods the user could use. It already filters if the client allows the verification method. Furthermore the medium id is required, it will be provided in the initiation request. The type specifies the verification method and will be provided as value in the initiation request, too.
Response
{
"configured_list": [
{
"type": "EMAIL",
"mediums": [
{
"id": "72873fb5-0c21-4f15-b4f5-c4a0824e09f4",
"key_name": "aca******as@w***s.in"
}
]
},
{
"type": "PASSWORD"
}
]
}
Step 2: Initiating the Authentication
When the user now selects password, you need to initiate the authentication using password as parameter.
Request
curl --location '{base_url}/verification-srv/authentication/password/initation' \
--header 'content-type: application/json' \
--data-raw '{
"usage_type": "PASSWORDLESS_AUTHENTICATION",
"request_id": "10696da7-a92a-43d8-bc6e-428c1f6025f1",
"medium_id": "PASSWORD",
"type": "password",
"email": "[email protected]"
}'
The response contains a status_id and exchange_id, those are unique for this process and the following steps will rely on this being provided. If Status is 200, the initiation was successfully triggered.
Response
{
"success": true,
"status": 200,
"data": {
"exchange_id": {
"exchange_id": "6915d3b2-c183-40aa-aa2c-e9c82eedda09",
"expires_at": "2024-01-12T13:11:17.203Z",
"_id": "93f9d23c-09cc-4947-8df6-87190430409f",
"createdTime": "2024-01-12T12:41:17.204Z",
"updatedTime": "2024-01-12T12:41:17.204Z",
"__ref": "4908129189115a60:736d055ffe8243d2:4908129189115a60:0",
"id": "93f9d23c-09cc-4947-8df6-87190430409f"
},
"sub": "c873de5d-53ce-47-0fce41722138",
"status_id": "c0667444-1f71-45c5-8f8c-1f7b4"
}
}
exchange_id and masked sub which are required as input for Step 3Step 3 : Performing the Authentication
Using the exchange_id, requestId, type and password sent in the request the actual authentication will now take place.
curl --location '{base_url}/verification-srv/authentication/password/initation' \
--header 'content-type: application/json' \
--data '{
"exchange_id": "d594490e-a4da-4433-81a8-2009744ebb48",
"requestId": "44437a97-ebe5-4c07-87ec-ed31b0c87e1a",
"type": "password",
"password": "AdminTesting@456"
}'
The response returns another exchange_id and status 200 success if it was successfully performed.
{
"success": true,
"status": 200,
"data": {
"exchange_id": {
"exchange_id": "94669e02-d666-4be5-8f4d-130664c6d57c",
"expires_at": "2024-01-12T13:24:40.706Z",
"_id": "a69bb211-387b-47b1-b19d-5da3b91c15ba",
"createdTime": "2024-01-12T12:54:40.709Z",
"updatedTime": "2024-01-12T12:54:40.709Z",
"__ref": "1ede4f31b521fc74:76e4c2fc2e83313a:1ede4f31b521fc74:0",
"id": "a69bb211-387b-47b1-b19d-5da3b91c15ba"
},
"sub": "521bb9c7-eda9-4070-ab28-551825a3b502",
"status_id": "e3f1ad0e-b32d-4304-8861-d8dff503396a"
}
}
exchange_id and status_id which are required as input for Step 4. The exchange_id changes between the above steps.Step 4: Performing the login
Continue the login process by performing the login Call. This API will redirect when the authentication was successful to group selection page .
Request
curl --location '{base_url}/login-srv/verification/login' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'requestId=df08cabb-4b8c-4181-9f6f-f6948802ebf7' \
--data-urlencode 'exchange_id=e8896cfe-8371-4d79-b8d5-ae8f14c5666c' \
--data-urlencode 'verificationType=password' \
--data-urlencode 'sub=b0dd23-1a2d-40eb-9gb-2ba3cc1942b' \
--data-urlencode 'status_id=710792ba-32f9-4d2d-8584-fefa3a6d94b8' \
--data-urlencode 'rememberMe=true'
- Login API then automatically redirects the user's browser to the group selection hosted page (
/identity/groupselection). Thetrack_idand other parameters are passed in the redirect URL query parameters.
/identity/groupselection is a hosted page URL, not a direct API endpoint. The user is automatically redirected to this page in their browser where they can select a group from the provided list. The actual API call to continue the flow happens in Step 6 after the user selects a group.Step 5: Understanding the Response of Token Prelogin Metadata
The API to return the prelogin metadata information allows you to actually find out which groups can be selected.
curl 'https://demo.cidaas.de/token-srv/prelogin/metadata/958ccb4c-3985-4b17-b325-14cd10da292e?acceptLanguage=en-US' \
--compressed
Retrieving the token prevalidation information will reveal which selectable groups so the user can choose one of those groups, to be able to continue. This response body illustrates an array of selectable groups.
{
"success": true,
"status": 200,
"data": {
"logged_in": false,
"validation_type": "group_selection_required",
"meta_data": {
"amr_values": [
"103"
],
"selectableGroups": [
{
"groupId": "Group_A",
"groupName": "Group_A",
"groupType": "widas_developer"
},
{
"groupId": "Group_B",
"groupName": "Group_B",
"groupType": "widas_developer"
}
]
},
"used": false
}
}
Step 6: Understanding the Response of Token Prelogin Continue Call
Continue Authentication Flow after Prechecks. This precheck API will redirect when the authentication was successful to your provided redirect_uri including a code or adding the selected group to access token depending on the OAuth2 Flow used.
curl --location '{base_url}/login-srv/precheck/continue/jbgq2375-a4da-f090-81a8-i90k744ebb4' \
--header 'content-type: application/json' \
--data '{
"track_id": "jbgq2375-a4da-f090-81a8-i90k744ebb4",
"selectedGroupId": "Group_A"
}'
The continue / login step sends the chosen group as selectedGroupId in the request body. After a successful flow, the access token carries the selected group in the groups claim (entry groupId), not a groupSelected claim.
Developer Perspective
| API | Description | Link |
|---|---|---|
| Authorization Request | Initiates the OAuth2 authorization flow. Use group_hint=<groupId> to pre-select a group and skip the selection UI, or prompt=select_group so renew does not reuse the previous group silently (screen still only when more than one selectable group applies). | View API |
| Get the configured authentication methods | Displays the configured authentication methods on the user login page, e.g., after configuring a pattern; The user gets the pattern mfa on the login page. | View API |
| Initiate the authentication | This API is used to initiate the configured authentications, e.g., when a user clicks on the password authentication, it initiates the password authentication. | View API |
| Perform the authentication | After successfully authenticating by entering the password, the enrollment completion will finally enrol the user. | View API |
| Continue Login After Passwordless Authentication | After successfully authenticating, you can proceed the login process | View API |
| Get Pre-Login Metadata | Retrieves the list of selectable groups that the user can choose from during group selection. | View API |
| Continue Authentication Flow after Prechecks | Continue the login process after the user has selected a group. This will add the selected group to the access token. | View API |
| Create group selection configuration | Create a reusable Trustdesk Group Selection configuration (/groups-srv/group-selection). | View API |
| Search group selection configurations | List/search reusable group selection configurations. | View API |
prompt=select_group blocks silent reuse of the previous group on renew. The selection screen still appears only when more than one selectable group applies.Implementation using SDK
This Implementation Guide is based on the default hosted pages which uses an Angular framework based on Typescript. It can be implemented in any other programming language as well.
As a first step you will be redirected to the login page. This Section starts to show the apis to be called when reaching this page:
To install the cidaas-sdk please perform the following command
npm install cidaas-javascript-sdk
The import to your webapp will be done by using:
this.cidaas_sdk = new WebAuth(options)
Step 1: Rendering the User Verification Methods
To call the getMFAList API to get all the MFA that is configured for the user
const queryParams = new URL(window.location.href).searchParams; // get query params from window.location
const payload = {
sub: queryParams.get("sub"), // subId of user got from query params
requestId: queryParams.get("requestId"), // requestId identifying active login flow
}
this.cidaas_sdk.getMFAList(payload)
.then((response) => {
if (!response.data || response.status !== 200) {
// handle error
return;
}
const mfaList = response.data;
// Populate mfa list
showMFAList(mfaList); // Add implementation to parse mfa list and show in UI
})
.catch((e) => {
// handle error
});
Using the response of this API call, you can render the UI as display all verification methods the user is allowed and able to use. Furthermore it is used as input for the next Endpoint.
Step 2: Initiating password
After the user selected the authentication method, To initiate the verification process, the payload needs to be set In this scribble the mfaItems are the items returned by the above api, when already knowing the mfaItem (singular) is the user-selected method and the index.
request_id : It is the requestId that is generated for the login, we can get this id from dataService. usage_type : specifies the type of authentication, for this it is PASSWORDLESS_AUTHENTICATION type : It is the selected verification type from the list, for this the value is password usernameType : It is the key value for the payload, first priority is email, second is user_name & third is mobile_number
let exchangeId: string = "";
const queryParams = new URL(window.location.href).searchParams; // get query params from window.location
const requestId = queryParams.get("requestId");
const type = queryParams.get("type") as string; // It contains either the `email` or `user_name` or `mobile` as a key
const userId = queryParams.get("userIdHint"); // It is either the email, user name or mobile number of the user
const payload = {
usage_type: "PASSWORDLESS_AUTHENTICATION",
request_id: requestId,
[type]: userId
}
// initiate api call which returns exchange_id
this.cidaas_sdk.initiateMFAV2(payload)
.then((response) => {
if(response || response.status !== 200){
// handle error
return;
}
const data = response.data;
this.exchangeId = data?.exchange_id?.exchange_id;
})
.catch(error=>{
// handle error
})
Step 3: Performing the Authentication
The next step is to perform the authentication. Thereby the exchangeId as well as verificationType will be provided in the next authentication step. The requestId stays same as before.
const exchangeId = this.exchangeId; // This is generated after initiate process (Step 3)
const queryParams = new URL(window.location.href).searchParams; // get query params from window.location
const requestId = queryParams.get("requestId");
let payload = {
requestId: requestId,
exchange_id: exchangeId,
type: "password",
password: "Test1567" // This is the password that user enters while login.
};
this.cidaas_sdk.authenticateMFAV2(payload)
.then((response) => {
if(response || response.status !== 200) {
// handle error
return;
}
const data = response.data;
this._initiatePasswordlessLogin(data); // initiate the login process
})
.catch((error) => {
// handle error
})
Step 4: Continue the login Process
The passwordlessLogin will continue the login process and finally the user will be redirected to the provided redirect_uri including a token or code, depending on the OAuth2-grant (OAuth2-Flow) was used during initiating the authentication process.
_intitiatePasswordlessLogin = async (response) => {
const queryParams = new URL(window.location.href).searchParams; // To get query params from window.location
const requestId = queryParams.get("requestId");
let options = {
requestId: requestId,
exchange_id: response.exchange_id.exchange_id,
verificationType: "password", // this is selected from the list of MFA, for this the value is `password`
sub: response.sub,
status_id: response.status_id, // The status ID is generated after authenticate process
};
await this.cidaas_sdk.passwordlessLogin(options) // here it is going to call groupselection api which will get the list of user selectable groups from the configured list.
};
Step 5: Retrieving the Selectable Groups using Token Prelogin Metadata
const resp = await this.cidaas_sdk.getPreloginMetadata({
track_id: this.route.snapshot.queryParams['track_id'],
locale: navigator.language,
});
Using the response of this API call, you can render the UI as displayed above. It will present the selectable groups in the meta_data.selectableGroups array.
Step 6: Continue precheck call
This endpoint allows you to continue the authentication process to finally issue a code or token. This call should be performed after successful user interactions that were unfulfilled during the initial login request.
The Track ID was generated during the login call and is issued when a condition is unmet but required. This might be related to the user or related to the app settings.
The redirect_uri specified in the authorization flow is then returned along with either a code or an access token, depending on the authorization flow.
Hence the condition here is group_selection_required and after user selects a group to login with is taken by this endpoint and this will be added in the access token.
const resp = await this.cidaas_sdk.mfaContinue({
track_id: this.route.snapshot.queryParams['track_id'],
selectedGroupId: "Group_A" // this is a group that is selected by user, replace this by your group selection
});
Explore Related Topics
Please contact us directly on our support page or reach out to cidaas support at [email protected].