This document describes the NATS subject for linking verified identities to user accounts.
After successfully verifying an email address and receiving an ID token, link the verified email identity to the user's account.
Subject: lfx.auth-service.user_identity.link
Pattern: Request/Reply
The request payload must be a JSON object containing the user's JWT token and the ID token from the email verification step:
{
"user": {
"auth_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
},
"link_with": {
"identity_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}user.auth_token: A JWT access token for the Auth0 Management API with theupdate:current_user_identitiesscope. Theuser_idwill be automatically extracted from thesubclaim of this token.link_with.identity_token: The ID token obtained from the email verification process that contains the verified email identity
The service links the verified email identity to the user account without changing the user's current global session:
Success Reply:
{
"success": true,
"message": "identity linked successfully"
}Error Reply (Invalid Token):
{
"success": false,
"error": "jwt verify failed for link identity"
}Error Reply (Link Failed):
{
"success": false,
"error": "failed to link identity to user"
}# Link the verified email identity to the user account
nats request lfx.auth-service.user_identity.link '{
"user": {
"auth_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
},
"link_with": {
"identity_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}'
# Expected response: {"success":true,"message":"identity linked successfully"}- The SSR application must provide the user's JWT token (
user.auth_token) with theupdate:current_user_identitiesscope - The Auth Service automatically extracts the
user_idfrom thesubclaim of the user's token - The Auth Service verifies the JWT token signature and validates the required scope before processing
- The Auth Service uses the user's token (not the service's M2M credentials) to call the Auth0 Management API
- This ensures the operation is performed with the user's permissions and does not change their current global session
- The
link_with.identity_tokenfield contains the ID token from the email verification process with the verified email information that will be linked to the user account - This feature is only supported for Auth0. Authelia and mock implementations do not support this functionality yet.
For a complete understanding of how this operation fits into the email verification and linking flow, see the Email Verification Documentation which includes a comprehensive flow diagram showing all three steps (Steps 1-2: Email Verification, Step 3: Identity Linking).