Dynamic Keys

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

Usage

  1. Dynamic keys can be specific items you may want to pass to the email, SMS for the various authentication methods as a part of custom templates. Refer custom templates here.
  2. These also can be utilized under conditional flows where users can check with values for respective keys to create conditional statements.

Default Dynamic Keys

Dynamic Keys in Descope belong to a few categories.

User and unauthUser

The user and unauthUser keys load the details of an authenticated user (user) or an unauthenticated user (unauthUser) during the flow execution. The user keys guide provides detailed documentation of these keys.

AuthInfo

  • authInfo : Keys 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 keys in a flow condition:

AuthInfo Example in Flow

Device

  • device : Key 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 keys in a flow condition:

Device Key Example in Flow

Form

  • form : Keys 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 keys in a flow condition:

Form Email Domain Example in Flow

RiskInfo

  • riskInfo : Keys prefixed with riskInfo are specifically used for risked based authentication.
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.vpnDetectedIndication of whether the end user is using a VPN
riskInfo.newDeviceIndication of whether the end user is using a device that hasn't been spotted before in your application
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 keys in a flow condition:

Risk Info Example in Flow

Note

For more use cases on using riskInfo key, refer here

UserAgent

  • userAgent : Keys prefixed with userAgent provide with 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 keys in a flow condition:

User Agent Example in Flow

Additional Context Keys

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

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

  • 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 Dynamic Keys 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