Auth is a service for configuring authentication and authorization in your Tailor Platform application, providing user profile mapping, machine users, and OAuth 2.0 client configuration.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tailor-platform/sdk/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Auth provides:- User profile mapping to TailorDB types
- Machine users for service-to-service authentication
- OAuth 2.0 client configuration
- Identity provider integration
Configuration
Configure Auth service usingdefineAuth():
Definition Rules:
- One auth per application: Each application can have exactly one Auth service
- Configuration location: Define in
tailor.config.tsusingdefineAuth()and reference directly in the config’sauthfield
example/tailor.config.ts
User Profile
Maps authenticated identities to a TailorDB type:example/tailordb/user.ts
The TailorDB type that stores user records
The field in the TailorDB type used as the username. This field must have a unique constraint (
.unique()) since it is used to uniquely identify users.Specifies which fields from the TailorDB type are used as user attributes. Set to
true to enable a field. Enabled attributes must be assigned values in all machine user definitions. Only fields with ValueOperand types (string, boolean, string[], boolean[]) can be used as attributes.Attribute List
In addition toattributes (key-value map), you can configure attributeList to expose UUID-type fields as an ordered list:
An array of field names from the TailorDB type. These fields will be exposed as an ordered list of UUIDs. Only UUID-type fields (non-array) can be included in the attribute list.
attributeList values are accessible via user.attributeList as a tuple:
Machine User Attributes (without userProfile)
When you want to use machine users without defining auserProfile, define machineUserAttributes instead:
user-defined.d.ts, run:
Machine Users
Service accounts for automated access without user interaction:Values for attributes enabled in
userProfile.attributes (or all fields defined in machineUserAttributes when userProfile is omitted). All enabled fields must be set here. These values are accessible via user.attributes.Values for fields enabled in
userProfile.attributeList. Must be an array of valid UUIDs in the same order as declared in userProfile.- CI/CD pipelines
- Background jobs
- Service-to-service communication
- E2E testing
Using auth.invoker()
Theauth.invoker() method creates a type-safe reference to a machine user for use in workflow triggers:
example/resolvers/triggerWorkflow.ts
invoker() method is type-safe and only accepts machine user names defined in the auth configuration.
OAuth 2.0 Clients
Configure OAuth 2.0 clients for third-party applications:Allowed redirect URIs after authentication
Optional description of the client
Supported OAuth 2.0 grant types:
authorization_code- Standard OAuth 2.0 authorization code flowrefresh_token- Allow refreshing access tokens
Optional access token lifetime in seconds. Minimum: 60 seconds, Maximum: 86400 seconds (1 day). If not specified, uses platform default.
Optional refresh token lifetime in seconds. Minimum: 60 seconds, Maximum: 604800 seconds (7 days). If not specified, uses platform default.
Optional boolean to require DPoP (Demonstrating Proof of Possession) for this client. When set to
true, the client must use DPoP tokens for authentication.