Dynamic Values

This guide will cover using dynamic values within Descope flows, conditions, messaging templates, etc. Dynamic values in Descope hold values of attributes regarding the user, device, etc., which users can utilize for various authentication flows. Dynamic values can be used within Descope conditions, actions, connectors, etc.

Usage

  1. Dynamic values can be specific items you may want to pass to the email or SMS for the various authentication methods as a part of custom templates. Refer to custom templates here.
  2. These also can be utilized under conditional flows where users can check dynamic values to create conditional statements.
  3. You can also use these values to display to the user within the Descope flow screens.

Default Dynamic Values

Dynamic Values in Descope belong to a few categories.

User

  • user: Keys prefixed with user are used for authenticated users.
Dynamic KeyDescription
user.userIdA unique identifier for a user
user.loginIdsAll unique identifiers for a user. Usually an email and/or phone
user.nameThe user's name
user.givenNameThe user's given name
user.middleNameThe user's middle name
user.familyNameThe user's family name
user.emailThe user's email address
user.emailDomainThe domain of the user's email address
user.phoneThe user's phone number
user.verifiedEmailWhether the user's email address has been verified
user.verifiedPhoneWhether the user's phone number has been verified
user.userTenantsAn array of tenants associated with the user
user.pictureThe user's picture
user.statusThe user's status including active , invited or disabled
user.tenantNamesAll user tenant names as array
user.tenantIdsAll user tenant IDs as array
user.tenant.rolesThe tenant level user roles
user.fingerprint.knownDeviceIndication of whether the unauthenticated user is using a device that has been spotted before in your application
user.testWill be set to true if this user is a test user
user.lastAuth.countryLast country user logged in from
user.lastAuth.countriesLatest countries user logged in from
user.lastAuth.cityLast city user logged in from
user.lastAuth.citiesLatest cities user logged in from
user.lastAuth.ipLast IP user logged in from
user.lastAuth.ipsLatest IPs user logged in from
user.lastAuth.timeLast time user logged in
user.passwordIndicates whether the user has ever logged in with a password
user.totpIndicates whether user has TOTP set
user.project.rolesAll project level roles associated with this user
user.project.permissionsAll project level permissions associated with this user
user.samlIndicates whether the user has ever logged in with SAML
user.webauthnIndicates whether the user has ever logged in with Passkeys (Webauthn)
user.loggedInIndicates whether the user is already logged in
user.customAttributes.<attribute-name>The custom attribute for the user

Example of utilizing user Dynamic keys in a flow condition:

User key Example in Flow

UnauthUser

Descope allows you to load data for both authenticated and unauthenticated users. When a user first supplies their login ID (email, phone number, custom login ID, etc.) but has not completed authentication, you can load their details within your flow using the unauthUser dynamic keys.

  • unauthUser : Keys prefixed with unauthUser is used for unauthenticated users.
Dynamic KeyDescription
unauthUser.userIdA unique identifier for a user
unauthUser.loginIdsAll unique identifiers for a user. Usually an email and/or phone
unauthUser.nameThe user's name
unauthUser.givenNameThe user's given name
unauthUser.middleNameThe user's middle name
unauthUser.familyNameThe user's family name
unauthUser.emailThe user's email address
unauthUser.emailDomainThe domain of the user's email address
unauthUser.phoneThe user's phone number
unauthUser.verifiedEmailWhether the user's email address has been verified
unauthUser.verifiedPhoneWhether the user's phone number has been verified
unauthUser.userTenantsAn array of tenants associated with the user
unauthUser.pictureThe user's picture
unauthUser.statusThe user's status including active , invited or disabled
unauthUser.tenantNamesAll user tenant names as array
unauthUser.tenantIdsAll user tenant IDs as array
unauthUser.tenant.rolesThe tenant level user roles
unauthUser.fingerprint.knownDeviceIndication of whether the unauthenticated user is using a device that has been spotted before in your application
unauthUser.testWill be set to true if this user is a test user
unauthUser.lastAuth.countryLast country user logged in from
unauthUser.lastAuth.countriesLatest countries user logged in from
unauthUser.lastAuth.cityLast city user logged in from
unauthUser.lastAuth.citiesLatest cities user logged in from
unauthUser.lastAuth.ipLast IP user logged in from
unauthUser.lastAuth.ipsLatest IPs user logged in from
unauthUser.lastAuth.timeLast time user logged in
unauthUser.passwordIndicates whether the user has ever logged in with a password
unauthUser.totpIndicates whether user has TOTP set
unauthUser.project.rolesAll project level roles associated with this user
unauthUser.project.permissionsAll project level permissions associated with this user
unauthUser.samlIndicates whether the user has ever logged in with SAML
unauthUser.webauthnIndicates whether the user has ever logged in with Passkeys (Webauthn)
unauthUser.customAttributes.<attribute-name>The custom attribute for the user

Example of utilizing unauthUser Dynamic keys in a flow condition:

UnauthUser key Example in Flow

Example of utilizing unauthUser.lastAuth.time in a flow condition:

UnauthUser last login key Example in Flow

Using the dynamic key unauthUser.lastAuth.time, Descoper can control the behavior of the flow based on how long ago an unauthenticated user had logged in. The operator in the condition supports checking the time in terms of minutes, hours or days. This can help in use cases where user's last logged in time logic needs to be applied. A similar key is also available for check for authenticated users (user.lastAuth.time).

unauthUser Variations

By default, when using unauthUser context keys, the user is loaded by email; however, there may be scenarios where the user needs to be loaded by another variation. Descope supports loading unauthenticated users using unauthUser.byEmail (default), unauthUser.byPhone, and unauthUser.byTenant.

AuthInfo

  • authInfo: Values prefixed with authInfo provide authentication related information to the user.
Dynamic KeyDescription
authInfo.sessionJwtA JSON web token used for session authentication and authorization purposes
authInfo.refreshJwtA JSON web token used for obtaining a new sessionJwt after expiration
authInfo.cookieDomainThe domain that the cookie is valid for, used for cross-domain authentication
authInfo.cookiePathThe path that the cookie is valid for, used for limiting cookie access to specific paths
authInfo.cookieMaxAgeThe maximum duration for which the cookie is valid, in seconds
authInfo.cookieExpirationThe date and time at which the cookie expires, used for setting an explicit expiration date
authInfo.firstSeenWhether the user is logging in for the first time

Example of utilizing authInfo Dynamic values in a flow condition:

AuthInfo Example in Flow

Device

  • device: Values prefixed with device give information with respect to the user's device.
Dynamic KeyDescription
device.location.schemeThe scheme of the URL where the flow is used. Such as http or https.
device.location.uriThe full URI where the flow is used. Such as https://app.domain.com/path?q=v#fragment
device.location.hostnameThe hostname where the flow is used. Such as app.domain.com.
device.location.portThe port where the flow is used. Such as 3000
device.location.pathThe path where the flow is used. Such as /path
device.location.rawQueryThe raw query string where the flow is used. Such as "q=v"
device.location.fragmentThe fragment (the URI part after #) where the flow is used. Such as fragment, in case the full URI is https://app.domain.com#fragment
device.location.queryThe query object where the flow is used. Such as {"q":"v"}
device.webAuthnSupportIndicates whether the device supports Passkeys (Webauthn)

Example of utilizing device Dynamic values in a flow condition:

Device Key Example in Flow

Form

  • form: Values prefixed with form are specific to inputs provided by the user while authenticating into their application.
Dynamic KeyDescription
form.emailThe email form input
form.emailDomainThe domain of the email form input
form.phoneThe phone form input
form.photoThe picture uploaded by the "Take Photo" component
form.inviteesThe invitees form input
form.externalIdThe custom login ID form input
form.fullNameThe display name form input
form.firstNameThe given name form input
form.lastNameThe family name form input
form.tenantDomainThe tenant domain form input
form.middleNameThe middle name form input
form.selfProvisionDomainsThe self provision domains form input
form.impersonateIdThe impersonate ID selected from the form input
form.entityIdThe entity ID form input
form.tenantNameThe tenant name form input
form.idpCertThe IdP certificate form input
form.idpMetadataURLThe IdP metadata URL form input
form.idpURLThe IDP URL form input
form.displayNameThe display name form input
form.givenNameThe given name form input
form.familyNameThe family name form input
form.trustThisDeviceMark this device as trusted

Example of utilizing form Dynamic values in a flow condition:

Form Email Domain Example in Flow

RiskInfo

  • riskInfo: Values prefixed with riskInfo are specifically used for risked based authentication.

For more details on using riskInfo key, refer here. Fraud / Risk based connectors will have their own context keys that will only show up if the connector is configured.

Dynamic KeyDescription
riskInfo.botDetectedIndicates whether a user is likely a bot based on their behavior or activity
riskInfo.riskScoreA numerical value representing the risk score associated with a user's behavior or activity
riskInfo.trustedDeviceIndication of whether this device has been marked as trusted before or not
riskInfo.impossibleTravelIndication of whether this user has connected from two different countries and the time between those connections can't be made through conventional air travel

Example of utilizing riskInfo Dynamic values in a flow condition:

Risk Info Example in Flow

Note

For more use cases on using riskInfo key, refer here

UserAgent

  • userAgent: Values prefixed with userAgent provide details about the system, operating system, host application etc.
Dynamic KeyDescription
userAgent.mobileIs request coming from a mobile device?
userAgent.desktopIs request coming from a PC?
userAgent.deviceDevice type (present for iOS and Android devices)
userAgent.rawRaw User Agent header
userAgent.nameShort agent name
userAgent.osOperating system
userAgent.osVersionOperating system version
userAgent.tabletIs request coming from a Tablet?
userAgent.urlURL provided in case of a bot

Example of utilizing userAgent Dynamic values in a flow condition:

User Agent Example in Flow

jwtClaims

  • jwtClaims: Values prefixed with jwtClaims provide post-authentication details that are stored in the JWT response. Please note that these values will only be available after the user goes through an authentication flow.
Dynamic KeyDescription
jwtClaims.amrIdentifiers Used
jwtClaims.drnType of Token
jwtClaims.expTimestamp of Expiration Time
jwtClaims.issTimestamp of Issued Time
jwtClaims.subUser Id

In addition to the values above, custom claims on the JWT that are Strings will also be available. They can be accessed as jwtClaims.custom-claim-key.

Example of utilizing jwtClaims Dynamic values in a flow condition:

jwtClaims Example in Flow

Additional Context Keys

In addition to the default dynamic values mentioned above, Descope supports values created by connectors or scriptlets used in flows.

For more information on these, please refer to the following documents:

  • Scriptlets: Keys as a result of executing scriptlets in flows are in the format scripts.scriptletResult.xyz where xyz is the variable holding the result of the scriptlet action.
  • Connectors: Keys being returned from connectors are prefixed with connectors..
  • Document: Key used specifically for document being uploaded via flows.

The list of available Dynamic Values is continually expanding, but the guide above provides a solid foundation for understanding how they are used in Descope.

Was this helpful?

On this page