Navigation

Authentication Triggers

On this page

  • Overview
  • Create an Authentication Trigger
  • Authentication Events

Authentication triggers allow you to execute server-side logic whenever a user interacts with an authentication provider. You can use authentication triggers to implement advanced user management, including storing new user data in your linked cluster, maintaining data integrity upon user deletion, or calling a service with a user’s information when they log in.

Authentication events represent user interactions with an authentication provider. Each event corresponds to a single user action with one of the following operation types:

Operation Type
Description
LOGIN
Represents a single instance of a user logging in.
CREATE
Represents the creation of a new user.
DELETE
Represents the deletion of a user.

Authentication event objects have the following form:

{
"operationType": <string>,
"providers": <array of strings>,
"user": <user object>,
"time": <ISODate>
}
Field
Description
operationType
The operation type of the authentication event.
providers

The authentication providers that emitted the event.

One of the following names represents each authentication provider:

  • "anon-user"
  • "local-userpass"
  • "api-key"
  • "custom-token"
  • "custom-function"
  • "oauth2-facebook"
  • "oauth2-google"
  • "oauth2-apple"
Note

Generally, only one authentication provider emits each event. When a you delete a user linked to multiple providers, the DELETE event for that user includes all linked providers.

user
The user object of the user that interacted with the authentication provider.
time
The time at which the event occurred.
Give Feedback

On this page

  • Overview
  • Create an Authentication Trigger
  • Authentication Events