api.access
api.access.deny(reason)
api
object.
Parameter | Description |
---|---|
reason | String. A human-readable explanation for rejecting the
login. This is sent as |
api.accessToken
api.accessToken.setCustomClaim(name, value)
api
object.
Parameter | Description |
---|---|
name | String. Name of the claim (note that this may need to be a fully-qualified URL). |
value | Any value. The value of the claim. |
api.accessToken.addScope(scope)
api
object.
Parameter | Description |
---|---|
scope | String The scope to be added. |
api.accessToken.removeScope(scope)
api
object.
Parameter | Description |
---|---|
scope | String The scope to be removed. |
api.authentication
api.authentication.recordMethod(provider_url)
event.authentication.methods
array in subsequent logins.
Important: This API is only available from within the
onContinuePostLogin
function for
PostLogin
Actions. In other words, this may be used to record
the completion of a custom authentication method after redirecting the user
via api.redirect.sendUserTo()
.
Returns a reference to the api
object.
Parameter | Description |
---|---|
provider_url | String. A url representing the identity of the custom authenticated method that was completed. |
api.authentication.challengeWith(factor, options)
Parameter | Description |
---|---|
factor | Object. An object containing the Supported values include:
Example |
options | Optional object. An object containing the optional
Example |
api.authentication.challengeWithAny(factors)
Parameter | Description |
---|---|
factors | Array. An array of objects that includes the Supported values include:
|
api.authentication.enrollWith(factor, options)
Parameter | Description |
---|---|
factor | Object. An object containing the Supported values include:
|
options | Optional object. An object containing the optional
Example Example |
api.authentication.enrollWithAny(factors)
Parameter | Description |
---|---|
factors | Array. An array of objects that includes the Supported values include:
|
api.authentication.setPrimaryUser(primary_user_id)
setPrimaryUser()
function can be used to indicate that the subject of the login should be changed.
Important:
primary_user_id
. The login will fail and tokens will not be issued otherwise.Parameter | Description |
---|---|
primary_user_id | String. The user ID of the user for whom tokens should be issued (the |
api.cache
api.cache.delete(key)
CacheWriteResult
object with type: "success"
if a value was removed from the cache. A failed operation returns type: "error"
. For errors, the returned object will have a
code
property that indicates the nature of the failure.
Parameter | Description |
---|---|
key | String. The key of the record stored in the cache. |
api.cache.get(key)
key
, if it exists. If a record is found, the cached value can
be found at the value
property of the returned object.
Returns a cache record if an item is found in the cache for the supplied
key
. Cache records are objects with a
value
property holding the cached value as well as an
expires_at
property indicating the maximum expiry of
the record in milliseconds since the Unix epoch.
Important:
This cache is designed for short-lived, ephemeral data. Items may not be
available in later transactions even if they are within their supplied their
lifetime.
Parameter | Description |
---|---|
key | String. The key of the record stored in the cache. |
api.cache.set(key, value, [options])
ttl
or expires_at
values. If no lifetime is
specified, a default lifetime of 15 minutes will be used. Lifetimes may
not exceed the maximum duration listed at
Actions Cache Limits.
Returns CacheWriteSuccess
if the values are stored successfully. Otherwise, you will receive CacheWriteError
.
Parameter | Description |
---|---|
key | String. The key of the record stored in the cache. |
value | String. The value of the record to be stored. |
options | Optional object. Options for adjusting cache behavior. |
options.expires_at | Optional number. The absolute expiry time in milliseconds
since the unix epoch. While cached records may be evicted earlier,
they will never remain beyond the the supplied
Note: This value should not be supplied if a value was also
provided for |
options.ttl | Optional number. The time-to-live value of this cache entry
in milliseconds. While cached values may be evicted earlier, they
will never remain beyond the the supplied Note: This value should not be supplied if a value was also
provided for |
api.idToken
api.idToken.setCustomClaim(name, value)
api
object.
Parameter | Description |
---|---|
name | String. Name of the claim (note that this may need to be a fully-qualified URL). |
value | Any value. The value of the claim. |
api.multifactor
api.multifactor.enable(provider, options)
api
object.
Parameter | Description |
---|---|
provider | String. The name of the multifactor provider to use or the
value Supported values include:
|
options | Optional object. Additional options for enabling multifactor challenges. |
options.allowRememberBrowser | Optional boolean. When provider is set to |
options.providerOptions | Optional object. Additional options to configure the
challenge, only available for the Supported options include:
|
api.redirect
api.redirect.encodeToken(options)
sendUserTo
) that contains data whose
authenticity must be provable by the target endpoint. The target endpoint
can verify the authenticity and integrity of the data by checking the
JWT’s signature using a shared secret.
Returns a JWT string.
Parameter | Description |
---|---|
options | Options. Configure how sensitive data is encoded into the query parameters of the resulting url. |
options.expiresInSeconds | Number. Number of seconds before this token will expire (defaults to 900). |
options.payload | Options. The data intended to be passed to the target of the redirect and whose authenticity and integrity must be provable. |
options.secret | String. A secret that will be used to sign a JWT that is
shared with the redirect target. The secret value should be stored
as a secret and retrieved using
|
api.redirect.sendUserTo(url, options)
url
immediately after this
action completes.
Returns a reference to the api
object.
Parameter | Description |
---|---|
url | String. The url in which to redirect the user. |
options | Options. An object representing additional query string parameters that should be appended to the redirect URL. |
options.query | Options. Additional query string parameters that should be appended to the redirect URL. |
api.redirect.validateToken(options)
/continue
endpoint while verifying the authenticity and
integrity of that data.
Returns payload of the JWT token.
Parameter | Description |
---|---|
options | Options. Options for retrieving the data encoded in a JWT
token passed to the |
options.secret | String. Secret used to encode the token. |
options.tokenParameterName | String. The name of the query or body parameter that was
sent to the |
api.refreshToken
api.refreshToken.revoke(reason)
api
object.
Parameter | Description |
---|---|
reason | String. A human-readable explanation for rejecting the refresh token. This is sent as error_description to the application that initiated the request. |
api.refreshToken.setExpiresAt(absolute)
api
object.
Parameter | Description |
---|---|
absolute | Number. The absolute expiry time in milliseconds since the unix epoch. |
api.refreshToken.setIdleExpiresAt(idle)
api
object.
Parameter | Description |
---|---|
idle | Number. The inactivity expiry time in milliseconds since the unix epoch. This method sets the refresh token inactivity timeout for the current interaction. If the method is not reapplied, subsequent successful interactions will override the inactivity timeout using the refresh token inactivity timeout settings. |
api.rules
api.rules.wasExecuted(ruleId)
true
when the Rule with the provided ID has been executed in this transaction and false
when it has not..
Parameter | Description |
---|---|
ruleId | String. The Rule ID to check. |
api.samlResponse
api.samlResponse.setAttribute(attribute, value)
Error
. For errors, the returned
object has a message that indicates the nature of the failure.
The value must be of type SAMLValue
, which can be
string | number | boolean | null | Array
Parameter | Description |
---|---|
attribute | String. The SAML attribute to be set. |
value | SAMLValue. The value of the SAML assertion. This may be set
to |
api.samlResponse.setAudience(audience)
Parameter | Description |
---|---|
audience | String. The SAML audience to be set. |
api.samlResponse.setIssuer(issuer)
urn:TENANT
.
Parameter | Description |
---|---|
issuer | String. The SAML issuer to be set. |
api.samlResponse.setEncryptionPublicKey(publicKey)
Parameter | Description |
---|---|
publicKey | String. The public key to be set. |
api.samlResponse.setRecipient(recipient)
AssertionConsumerUrl
on SAMLRequest
or callback
URL if no SAMLRequest was sent.
Parameter | Description |
---|---|
recipient | String. The SAML recipient to be set. |
api.samlResponse.setCreateUpnClaim(createUpnClaim)
true
.
Parameter | Description |
---|---|
createUpnClaim | Boolean Toggle to create a UPN claim. |
api.samlResponse.setPassthroughClaimsWithNoMapping(passthroughClaimsWithNoMapping)
true
(default), for each claim that is not mapped to the
common profile, Auth0 passes through those in the output assertion. If
false
, those claims won’t be mapped.
Parameter | Description |
---|---|
passthroughClaimsWithNoMapping | Boolean Should claims should be mapped to the output assertion. |
api.samlResponse.setMapUnknownClaimsAsIs(mapUnknownClaimsAsIs)
passthroughClaimsWithNoMapping
is true
and this
is false
(default), for each claim not mapped to the common
profile Auth0 adds a prefix http://schema.auth0.com. If true
,
it will pass through the claim as-is.
Parameter | Description |
---|---|
mapUnknownClaimsAsIs | Boolean Should claims should be mapped as-is. |
api.samlResponse.setMapIdentities(mapIdentities)
true
(default), this adds more information in the token such
as the provider (Google, ADFS, AD, etc.) and the access token, if available
Parameter | Description |
---|---|
mapIdentities | Boolean Should identities be mapped. |
api.samlResponse.setDestination(destination)
Parameter | Description |
---|---|
destination | String Destination of the SAML response. |
api.samlResponse.setRelayState(relayState)
RelayState
on SAMLRequest
.
Parameter | Description |
---|---|
relayState | String RelayState of the SAML response. |
api.samlResponse.setLifetimeInSeconds(lifetimeInSeconds)
3600
seconds (1
hour).
Parameter | Description |
---|---|
lifetimeInSeconds | Number Expiration of the token in seconds. |
api.samlResponse.setSignResponse(signResponse)
true
,
SAML Response will be signed instead of SAML assertion. Default to
false
.
Parameter | Description |
---|---|
signResponse | Boolean Should the SAML response be signed. |
api.samlResponse.setNameIdentifierFormat(nameIdentifierFormat)
urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
.
Parameter | Description |
---|---|
nameIdentifierFormat | String The Name ID Format. |
api.samlResponse.setNameIdentifierProbes(nameIdentifierProbes)
user_id
)email
)name
)Parameter | Description |
---|---|
nameIdentifierProbes | String array An array of attributes to try for the name identifier. |
api.samlResponse.setAuthnContextClassRef(authnContextClassRef)
urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified
.
Parameter | Description |
---|---|
authnContextClassRef | String The AuthnContextClassRef. |
api.samlResponse.setSigningCert(signingCert)
"-----BEGIN CERTIFICATE-----\nMIIC8jCCAdqgAwIBAgIJObB6jmhG0QIEMA0GCSqGSIb3DQEBBQUAMCAxHjAcBgNV\n[..all the other lines..]-----END CERTIFICATE-----\n"
.
Parameter | Description |
---|---|
signingCert | String Optional public key certificate used to validate SAML requests. |
api.samlResponse.setIncludeAttributeNameFormat(includeAttributeNameFormat)
true
, we infer the NameFormat based on the
attribute name. NameFormat values are
urn:oasis:names:tc:SAML:2.0:attrname-format:uri
,
urn:oasis:names:tc:SAML:2.0:attrname-format:basic
and
urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified
.
If set to false
, the attribute NameFormat is not set in the
assertion. Default is true
.
Parameter | Description |
---|---|
includeAttributeNameFormat | Boolean Should NameFormat be inferred based on the attribute name. |
api.samlResponse.setTypedAttributes(typedAttributes)
true
, we infer the xs:type
of the
element. Types are xs:string
, xs:boolean
,
xs:double
and xs:anyType
. When set to
false
all xs:type
are xs:anyType
.
Default is true
.
Parameter | Description |
---|---|
typedAttributes | BooleanShould |
api.samlResponse.setEncryptionCert(encryptionCert)
"-----BEGIN CERTIFICATE-----\nMIIC8jCCAdqgAwIBAgIJObB6jmhG0QIEMA0GCSqGSIb3DQEBBQUAMCAxHjAcBgNV\n[..all the other lines..]-----END CERTIFICATE-----\n"
.
Parameter | Description |
---|---|
encryptionCert | String Optional certificate to encrypt the SAML assertion. |
api.samlResponse.setCert(cert)
"-----BEGIN CERTIFICATE-----\nMIIC8jCCAdqgAwIBAgIJObB6jmhG0QIEMA0GCSqGSIb3DQEBBQUAMCAxHjAcBgNV\n[..all the other lines..]-----END CERTIFICATE-----\n"
.
Parameter | Description |
---|---|
cert | StringOptional certificate to sign the SAML responses or assertions. |
api.samlResponse.setKey(key)
"-----BEGIN PRIVATE KEY-----\nnMIIC8jCCAdqgAwIBAgIJObB6jmhG0QIEMA0GCSqGSIb3DQEBBQUAMCAxHjAcBgNV\n[..all the other lines..]-----END PRIVATE KEY-----\n"
.
Parameter | Description |
---|---|
key | StringOptional private key to sign the SAML responses or assertions. |
api.samlResponse.setSignatureAlgorithm(signatureAlgorithm)
rsa-sha256
Parameter | Description |
---|---|
signatureAlgorithm |
|
api.samlResponse.setDigestAlgorithm(digestAlgorithm)
sha256
Parameter | Description |
---|---|
digestAlgorithm |
|
api.session
api.session.revoke(reason, options)
api
object.
Parameter | Description |
---|---|
reason | String. A human-readable explanation for rejecting the login. This is sent as error_description to the application that initiated the request. |
options | preserveRefreshTokens. is a boolean used to specify if revoke will preserve the refresh tokens bound to the session with the same session_id. Defaults to false. Example |
api.session.setExpiresAt(absolute)
api
object.
Parameter | Description |
---|---|
absolute | Number. The absolute expiry time in milliseconds since the unix epoch. |
api.session.setIdleExpiresAt(idle)
api
object.
Parameter | Description |
---|---|
idle | Number. The inactivity expiry time in milliseconds since the unix epoch. This method sets the session inactivity timeout for the current interaction. If the method is not reapplied, subsequent successful interactions will override the inactivity timeout using the session inactivity timeout settings. |
api.transaction [Early Access]
api.transaction.setMetadata(name, value) [Early Access]
event.transaction.metadata
object in the current and subsequent Actions and persists throughout the entire transaction lifecycle.
They are subject to Transaction Metadata Limits. To learn more, read Actions Limitations .
NOTE: Transaction metadata is only available during the current authentication transaction and is not persisted beyond the completion of the authentication flow. This feature is only currently available on post-login
Actions.
Parameter | Description |
---|---|
key | String. The key of the metadata property to be set. |
value | String, Number, Boolean. The value of the metadata property. Set to |
api.user
api.user.setAppMetadata(name, value)
Deadline Exceeded
error.
Returns a reference to the api
object.
Parameter | Description |
---|---|
name | String. The name of metadata property. |
value | Any value. The value of the metadata property. This may be
set to |
api.user.setUserMetadata(name, value)
Deadline Exceeded
error.
Returns a reference to the api
object.
Parameter | Description |
---|---|
name | String. The name of metadata property. |
value | Any value. The value of the metadata property. This may be
set to |