Hi team, In the past two weeks, we encountered two...
# ask-a-descoper
d
Hi team, In the past two weeks, we encountered two cases where existing users attempted to log in and, after authentication, ended up without any roles assigned. In both situations, the tenants were configured with SSO via Okta. one using JIT provisioning and the other using SCIM. and in both, group-to-role mappings were defined. I’d like to understand whether there are best practices or safeguards that application developers can apply to better handle these scenarios, particularly around the integration points between the tenant, Okta, our application, and Descope. Additionally, are there any audit events available that track changes to a user’s roles? Currently, I don’t see anything related to this in the audit logs. Thanks
another question, is it possible that impersonating a user will modify it's roles as a side effect to that?
r
Hi Dror, Understanding Role Assignment with SSO When users authenticate via SSO, roles are assigned based on group mappings configured in Descope. Both JIT and SCIM provisioning rely on these mappings to assign roles automatically. Key Differences Between JIT and SCIM JIT Provisioning updates user attributes and groups "just in time as users log in" Doc. However, JIT has a critical limitation: it "only provisions users at the time of login; it does not update user attributes if they change in the IdP". Doc SCIM Provisioning provides more robust lifecycle management. Changes made in the IdP are "automatically pushed to Descope" and "applied to user sessions the next time the user logs in or refreshes their session token (JWT)". Doc Why Users Might Lose Roles here are potential causes: 1. Group Mapping Configuration: If no mapped roles are found from the user's groups, Descope assigns Default Roles as defined in the SSO configuration Doc Doc. If default roles aren't configured, users may end up with no roles. 2. JIT Limitation: With JIT provisioning, if a user's group membership changes in Okta between logins, those changes won't be reflected until the next login Doc. 3. SCIM Session Behavior: SCIM updates "do not immediately revoke existing user sessions" - changes apply "on the next login or token refresh" Doc. Best Practices and Safeguards • Configure Default Roles: Always configure Default Roles in your SSO configuration. These serve as a fallback "for assigning fallback access (e.g.,
read-only
) when group data is missing". • Validate Roles in Your Application: Check the
roles
claim in the user's JWT at critical points in your application. The roles are "included in the user's JWT (
roles
claim, under the associated tenant)". • Use Custom Audit Events: While standard audit events may not capture all role changes, you can create custom audit events using the
Generate Audit Event
action in Descope Flows. This action "creates custom audit events that are logged and available in your project's Audit page". ◦ You can configure it to track: ▪︎ Action name (e.g., "Role Assignment Check") ▪︎ Event type (Information, Warning, or Error) ▪︎ Event data including user information and role details • Consider SCIM Over JIT: For more reliable provisioning, SCIM is recommended when your IdP supports it. SCIM provides "continuous updates, group management, and de-provisioning", whereas JIT "does not update user attributes if they change in the IdP" • Verify Group Attribute Configuration: Ensure the Groups Attribute Name is correctly configured in your SSO mapping. In Okta specifically, verify that group attributes are properly set up in the SAML or OIDC configuration. Docs : https://docs.descope.com/management/tenant-management/scim https://docs.descope.com/auth-methods/sso/saml#configuring-sso-with-saml https://docs.descope.com/flows/actions/generate-audit-event https://docs.descope.com/sso/setup-guides/okta#configuring-scim Audit Events Custom audit events generated through the
Generate Audit Event
action will appear in your project's Audit page with timestamp, action name, event type, event data, and user information. This can help you track when users authenticate without expected roles Doc.
Impersonation is a session-level operation that allows one user to assume another user's identity temporarily. It does not modify the underlying user profile, including roles. If you're seeing role changes coinciding with impersonation events, there's likely a separate process modifying those roles (such as SCIM updates, manual changes, or other provisioning events). Doc
d
thanks for the explanation. regarding
Generate Audit Event
how do i know when in the flow i should add the action?
d
@Dror Rash you can mark the groups saml attribute as mandatory, so your customer will must fill it (it doesn't guarantee correct mapping but can help), and you can define a default role for your application in case no roles assigned.
Regarding the custom audit event, you can have if after the SSO action, but it won't work for scim
d
so how can i audit changes in users roles when scim is configured? if i want to know why/when user's roles changed?
d
For roles changed you have it automatically
You don't need a custom audit.
I guess you wanted to add a dedicated audit in case no roles provided.
But not sure how will it help, if you want to be 100% sure the user has always a role no matter what you need to define default role, since you can't control your customers’ IdP. And define groups to be mandatory.
d
is there a place i can see the full response from the IDP? i'll describe the issue i am trying to figure out. i have an existing user that tried to login unsuccessfully, all i see in the audit logs are LoginStarted events, the SAML request is the same as in previous successful login attempts the user had prior to that. after the user cleared it's cookies he was able to login. i suspect it has something to do with the groups but we are missing audit logs.
d
You can see the full IdP SAML/OIDC Response in the Login Success audit log.
d
@Doron Sharon that's the problem, the flow stops after the
LoginStarted
event. so i can't see the response from the IDP
d
Can it be that the IdP did not send the saml response to the acs callback at all? Can you send the project and tenant ids? And the time it happened.
d
i'll send it as a DM if that's ok
d
The warn I see for this tenant:
Copy code
[E064011] JWT inactive for too long: JWT was inactive for too long
JWT Issued at:
2025-12-09T14:55:23Z
Inactivity time from settings:
15000
(~4 hours)
It looks like the response parsed correctly, but it is something with the JWT inactivity, can it be that there is a cookie with that JWT for more than 4 hours?
I’m not sure if this is the problem, but this is the only warn I see for this tenant.
d
it is possible, but shouldn't the cookie be invalidated as part of the login flow?
for some reason the cookie was not invalidated
so only after clearing the cookie manually by the user he could login
d
At the end of the flow a new cookie is generated, need to understand your flow/settings to see if there is something blocking this. I do see that after the warning a new JWT got created.
And the flow ended successfully. But I might not look at the correct time it happened.
d
let me know what additional info you need from me
d
I don’t have access to that corllation ids you sent, you can send the time it happened maybe? or send the “Execution ID” from the login started event?
d
December 08, 2025 11:14
Copy code
1765185264651
d
Can you send the execution ID from that audit event as well?
d
only 1 out of the 3 logs has an execution id
36YZ6MZZLppSgAkFpQUwbOEOOTP
d
@Dror Rash this execution is not SSO
It is WebAuth (Passkeys)
And there is no login at all there.
I think there is a path that leads to no login in the flow.
d
can you explain, how did the user got there? is it an issue with the flow? with the integration to the IDP?
d
I see: • Sign In/ Passkeys (WebAuthn) • Enforce SSO Single Tenant • Is Email Verified? • Is new user? • Update Descope Admin Custom Claims • How many tenats does the user have? • First User Login Method • Check if Mail Subscription attribute is empty • Is new user?
These are the steps the user “visited” in your flow.
The user started from Passkey (which is biometrics)
Then the user goes into some conditions you have in the flow
d
the user has a single tenant with SSO configured
d
But there is no redirect to the SSO IdP in that specific execution.
The user did not go the the “SSO” action.
Look at your flow and let’s try to understand that condition leads to the SSO and what goes to the other direction.
Can you send the flow here?
d
the flow id?
sign-in-prod-flow
d
Or the flow file
But from the logs it says:
First User Login Method
Looking
Sorry, ignore the above, I looked in a different execution ID.
👍 1
OK I see that user redirected to the IdP successfully (Okta) And in the ACS SAML Callback response the user has
0
groups, but there are
2
default roles that got assigned to that user. But for some reason, I see that the flow execution never ended.
d
do you see the JWT the user got?
d
No, I don’t see it goes to the End of the flow.
Trying to understand why.
d
also, why did the user got 0 groups? this is the previous login, you can see he's part of a group
Copy code
"correlation_id": "36Q4icnLpuNDMGokBemyLsbyKhZ",
"flow_execution_id": "36Q4ih8xFr2dJUcn9MKkR8Owp4z",
Copy code
December 05, 2025 11:06 / 1764925589211
d
because their saml response was not contain any group…….
from the IdP
Okta did not return groups at the SAML Response (XML)
That’s need to ask your customer IT Admin
But as I wrote, the user was assigned with 2 default roles.
So it is not roles problem.
We opened internal issues to investigate that. If you can provide more execution ids that got that problem it will be great: I have the following:
Copy code
36YZ6MZZLppSgAkFpQUwbOEOOTP
36Q4ih8xFr2dJUcn9MKkR8Owp4z
For 36Q4ih8xFr2dJUcn9MKkR8Owp4z - I see it is a Step Up, correct?
d
not sure what you mean by Step Up, but it looks like successful logins
these are the only execution that we encountered that had the issue. if i understand the issue is that the default roles wasn't set to the user during the flow
i can continue and try to recreate the scenario
d
The first one (36YZ6MZZLppSgAkFpQUwbOEOOTP) has roles, so it is something else which we are checking. The second one (36Q4ih8xFr2dJUcn9MKkR8Owp4z) I see it started from SSO IdP Initiated, got 0 groups from the IdP, and there were no default roles, and then it goes to the “enrich token redirect” step and then to “Impersonate” and there is a condition of
Validate sufficient roles
which I guess that’s the problem.
So yes, looks like their IdP provided SAML Response with no groups for that user.
d
but
Validate sufficient roles
if there are insufficient roles should break with no error, so there could might be an issue with the condition validation
d
I see that it goes to the “End” of the flow. What error did you see?
For this execution the flow did not return any error, just moved to the End of the flow.
d
i don't see an error, but the user should get the default roles and for some reason it didn't get those
d
Where are the default roles defined?
d
SSO configuration
d
I think you need to define them in the project level, and not tenant level, since the IT Admin might not set them.
How do you set these default roles?
d
but we don't want to set the same default roles for each tenant
d
Right, so you can set the default role at the project level once:
From your screenshot I see it is configured per tenant.
d
yes, that's the idea
and that is from that specific tenant
d
So you set it automatically when the SSO is created?
Since it is per SSO configuration, so if the IT Admin is configuring their SSO, they might not set default roles.
Once the default roles are set in the SSO configuration the user will get them in case no groups provided by the IdP.
d
but that is not the case here, the tenant we have the issue has these default roles set
but for the specific flow excecuted that user did not get these roles
d
Are you sure the default roles were set at the exact time? Because from the logs it looks like there were no default roles defined.
I don’t have DB snapshot to look back in time.
For example, from the second execution ID I see in the logs that the default roles were defined and loaded.
And with the first execution ID I see that these default roles were not defined.
d
are there audit events to see changes in tenant SSO configurations?
d
yes
d
can i see these logs or are they exposed only internally?
d
You should have audit event called
TenantSettings
But we don’t log the entire settings since it might include sensitive information, so not sure it will help, you can see when the settings got modified and from where.
There is also event action called
SAMLSettings
d
last TenantSettings event for that tenant is from December 04, 2025 18:41 so there was the default roles defined at that time
d
And what about SAMLSettings and OAUTHSettings?
d
Screenshot 2025-12-11 at 19.55.06.png
is it possible that it's related to an impersonation flow. someone on our end impersonated to the user, the user is modified, than on the next real user login the default roles are not set because of some issue with the user state?
@Doron Sharon there's another attempt from today that with the same symptoms these attempts started today
December 11, 2025 19:46 / 1765475213928
last attempt is
December 11, 2025 19:53 / 1765475624485
d
Do you have the execution id?
d
36i2o2S6ihCMOtDNgqYB9G5rujv
d
Looking, I see the user got 3 roles assigned. By the way, this tenant SSO does not have default roles define, but it is not related in that case since the user got 3 roles due the group/roles mapping.
But I do see something that the flow got stopped at the middle, trying to understand why.
FYI I see this log as well, not sure if related but might be
Copy code
Ignoring custom claim field which is too big
Size is
1503
d
and do you see a similar error for the other user? maybe that's the reason? also how is this controlled? is it IDP or Descope side? the claim
d
I might be something else, it is coming from a
python
sdk, I guess it is something you are calling from your backend.
d
do you have any additional info, we have a NextJS application, not a
python
d
yes second
Management call to
/v1/mgmt/jwt/update
To this project:
P32lusHUPY06hG8MJtqJnKEmq7hJ
By this IP:
54.88.41.70
With this Mgmt Key ID:
K3340rb0ibyNDdMIcu8aeA9Yby1P
Using python sdk
python|1.7.12
But, I’m not sure this is the problem, I just saw this warn at the same time that you mentioned.
d
could it be Descope SDK?
d
It is from the Descope SDK for sure, I guess you use it somewhere.
It is coming from this IP:
54.88.41.70
d
we set the current tenant under custom claims
d
Using python sdk? In any case just make sure not to pass too big claim, since browser don’t like big cookies and omit them.
The claim we got is
1503
length
It is too big for a tenant name I think.
d
we use the node sdk
d
That’s strange. Do you recognize that IP?
54.88.41.70
d
i'll check
d
But in any case, it is not related to that issue.
I’m trying to understand the original issue.
d
also the client is only sending the tenant id to our backend and that is invoking the call to the SDK
d
ok, so it looks like that after the SAML Response sent to us in the acs url, we return the redirect with the 303 http code back to your app. That redirect location should have the flow component to proceed the flow.
It looks like it goes to a non flow page and just hang.
I see the post auth redirect url is
https://app.valkyrie.io/
I think that is the problem, the redirect URL should be
https://app.valkyrie.io/login
Otherwise, your app just recognize there is existing cookie and “let the user in”, and not proceed with the flow.
d
so the redirect currently set to
https://app.valkyrie.io
should be to
/login
?
d
I think I have talked about that with one of your engineers back then by the way:
Yes
But please do not do that all across your project, maybe better to test this first in staging?
Or only for a single tenant to make sure it works.
But I think that’s the problem, there is an existing cookie and it does not redirect to the /login which contains the flow, so the SSO does not reach to the end. And that’s why it works once you ask the customer to delete the cookie.
d
thanks, and how do you suggest i validate it, since as you see it's not happening consistently?
d
I would do what the customer did. • Login for the first time using non SSO -> works and have cookie set • Do another login but with SSO -> see that when coming back from the IdP your redirected to your app and logged with the non SSO user • Fix the post auth redirect url to have
/login
, repeat the steps and see that you are logged in with the SSO user
(Just make sure that you have post auth redirect url defined correctly in your dev/staging env)
d
in dev the flow looks complete, i see the default role in the audit logs but it's not applied to the user so i don't get the role
and i can't login
d
What are the project and tenant ids?
d
just checked it in my test tenant in prod env and getting the same result, user has no roles
the tenant is
valkyrie-test
the project is
P2eBJujlJH6Z5frTKzvQeXgW4PZf
d
In the logs I do see your user is assigned with 2 roles.
And there are 2 default roles
But again, do you have any cookie before? or is it a scratch sso?
d
from scratch, i tested in incognito
d
What is the user id?
d
dror@valkyrie.io-valkyrie-test
U36I3P4foZhcB4Czp5jb6TVKr4Tf
loginid and user id
d
Wait, I just noticed that JIT is disabled for that tenant, why?
JIT disabled means there is no Just In Time updates.
It means that the user updates are only via SCIM/Manually.
If you want to have Just In Time updates you need to make sure to turn on JIT.
You set it to false:
@Dror Rash
We have here an article explaining about JIT / SCIM, etc. https://docs.descope.com/sso/jit-provisioning
In nut shell • When using JIT - all user updates comes in the login time (from the IdP SAML Response) • When disabling JIT - all users updates comes from SCIM events / manually updates
d
ok, for my user that worked. but for the customer tenants that still doesn't resolve the issue. those are returning users that has successful logins, but once the cookie has expired it's on the next login they won't get roles. and both are defined differently, one is not JIT but has default roles and the other has JIT enabled but no default roles.
d
the one with the cookies is because of the redirect url
that need to end with the
/login
d
thanks, I'll try to validate it
Subject: Clarification & Alignment on SSO / Role Assignment Issues for Two Tenants Hi Team, I want to recap our current issue and verify alignment before we dive deeper. What we’re seeing We have an intermittent problem where users from two different tenants using SSO are not completing the login flow with the expected roles, in some cases they return authenticated from the IdP but end up with no roles assigned in the application. The tenant setups differ slightly: • Tenant 1 ◦ Using Just-In-Time (JIT) provisioning ◦ No default roles configured • Tenant 2 ◦ Using SCIM provisioning ◦ Default roles defined Both tenants have the same Post Authentication Redirect URL:
https://app.valkyrie.io
In both cases, when users return from the IdP to complete the login flow, it appears that stale/expired session cookies sometimes prevent the final step of the login, and users end up in an incomplete session with no roles applied. Verification Questions 1. Why isn’t this behavior consistent across all users in each tenant? The inconsistent behavior could be due to timing and how Descope handles session cookies and role resolution: • Role assignments (from group mappings, SCIM push, or default roles) are evaluated during the SSO login exchange, not after a stale/descope session cookie is reused. • If a session cookie is present and used instead of a fresh SSO code exchange, the backend may skip a full role resolution run, leading to missing roles. • Variability in IdP assertions (groups/attributes) or differences in who has active session cookies may make this issue sporadic rather than consistent. This behavior matches known patterns with cookie-managed sessions and IdP-initiated flows where a fresh exchange isn’t forced every time. 2. If default roles exist, will users receive both the default roles and the expected additional roles? Yes — default roles are fallback roles assigned when no mapped roles are present from group/attribute mappings. But: • If group/role mapping does produce roles from the IdP or SCIM groups on login, those mapped roles are applied. • Default roles apply only when no mapped role sources are present. • If you expect users to have default + other roles, you need to ensure that: ◦ Attribute/group mappings from the IdP include the additional expected roles, not only relying on default roles. ◦ SCIM provisioning populates groups/attributes before SSO. • Otherwise, default roles can be the only roles a user receives when no mapped roles arrive from SSO group data. 3. Will default roles be applied when JIT provisioning is not defined? In Descope: • Default roles are applied to users created via JIT when there are no mapped roles from the Identity Provider. • However: ◦ If JIT is disabled and only SCIM is used, the system should rely on SCIM-pushed group/role mappings. ◦ Default roles may still apply as a fallback if SCIM does not push any group/role attributes for a user — but this depends on the specific SCIM configuration and timing. • If JIT is disabled in favor of SCIM, it’s typically recommended that SCIM fully populate group memberships so that fallback scenarios are minimized. Additional Notes • The behavior where stale cookies interfere with completing the login flow is consistent with situations where Descope does not perform a fresh code exchange because the session is considered “already authenticated.” This means role resolution may not re-run. • Ensuring a reliable SSO flow often requires: ◦ Forcing a full IDP → Descope SSO handshake on first login (no reuse of stale cookies), or ◦ Clearing/refreshing sessions before SSO redirects are processed.
d
Correct
I think that once you will fix the post authentication redirect url, it will solve all the cookies problems, since you will redirect to the flow and the flow will proceed from the SSO step no matter if the user had a session cookie before
d
another follow up, i just integrated another tenant with Okta following SSO setup for the tenant and by default the Post Authentication URL is
https://app.valkyrie.io
is it possible to set to the project by default the URL
https://app.valkyrie.io/login
d
Yes, you already have
https://app.valkyrie.io
as the default for the project, just change it to
https://app.valkyrie.io/login
It is defined in the SSO project level: https://app.descope.com/settings/authentication/sso
d
great, thanks