apps/docs/content/apis/actions/external-authentication.mdx
This flow is executed if the user logs in using an identity provider.
The flow is represented by the following Ids in the API: FLOW_TYPE_EXTERNAL_AUTHENTICATION and 1
A user has authenticated externally. ZITADEL retrieved and mapped the external information.
The trigger is represented by the following Ids in the API: TRIGGER_TYPE_POST_AUTHENTICATION or 1.
ctx
The first parameter contains the following fields
accessToken string
The access token returned by the identity provider. This can be an opaque token or a JWTrefreshToken string
The refresh token returned by the identity provider if there is one. This is most likely to be an opaque token.claimsJSON() idTokenClaims
Returns all claims of the id tokengetClaim(key) Any
Returns the requested id token claimidToken string
The id token provided by the identity provider.v1
externalUser externalUserauthError string
This is a verification errors string representation. If the verification succeeds, this is "none"authRequest auth requesthttpRequest http requestproviderInfo Any
Returns the response of the provider. In case the provider is a Generic OAuth Provider, the information is accessible through:
rawInfo Anyorg
getMetadata() metadataResultapi
The second parameter contains the following fields
v1
user
appendMetadata(string, Any)
The first parameter represents the key and the second a value which will be storedsetFirstName(string)
Sets the first namesetLastName(string)
Sets the last namesetNickName(string)
Sets the nicknamesetDisplayName(string)
Sets the display namesetPreferredLanguage(string)
Sets the preferred language. Please use the format defined in RFC 5646setPreferredUsername(string)
Sets the preferred usernamesetEmail(string)
Sets the email address of the usersetEmailVerified(boolean)
Sets the email address verified or unverifiedsetPhone(string)
Sets the phone number of the usersetPhoneVerified(boolean)
Sets the phone number verified or unverifiedmetadata
Array of metadata. This function is deprecated, please use api.v1.user.appendMetadataA user selected Register on the overview page after external authentication. ZITADEL did not create the user yet.
The trigger is represented by the following Ids in the API: TRIGGER_TYPE_PRE_CREATION or 2.
ctx
The first parameter contains the following fields
v1
user (human)authRequest auth requesthttpRequest http requestorg
getMetadata() metadataResultapi
The second parameter contains the following fields
metadata
Array of metadata. This function is deprecated, please use api.v1.user.appendMetadatasetFirstName(string)
Sets the first namesetLastName(string)
Sets the last namesetNickName(string)
Sets the nicknamesetDisplayName(string)
Sets the display namesetPreferredLanguage(string)
Sets the preferred language, the string has to be a valid language tag as defined in RFC 5646setGender(int)
Sets the gender.
<ul><li>0: unspecified</li><li>1: female</li><li>2: male</li><li>3: diverse</li></ul>
setUsername(string)
Sets the usernamesetEmail(string)
Sets the emailsetEmailVerified(bool)
If true the email set is verified without user interactionsetPhone(string)
Sets the phone numbersetPhoneVerified(bool)
If true the phone number set is verified without user interactionv1
user
appendMetadata(string, Any)
The first parameter represents the key and the second a value which will be storedA user selected Register on the overview page after external authentication and ZITADEL successfully created the user.
The trigger is represented by the following Ids in the API: TRIGGER_TYPE_POST_CREATION or 3.
ctx
The first parameter contains the following fields
v1
getUser() userauthRequest auth requesthttpRequest http requestorg
getMetadata() metadataResultapi
The second parameter contains the following fields