Authenticating real-time API requests with Public Access Tokens or Trigger Tokens
auth.createPublicToken
function in your backend code:
expirationTime
is a string, it will be treated as a time spanexpirationTime
is a number, it will be treated as a Unix timestampexpirationTime
is a Date
, it will be treated as a datehandle
received includes a publicAccessToken
field. This token can be used to authenticate real-time requests in your frontend application.
By default, auto-generated tokens expire after 15 minutes and have a read scope for the specific run(s) that were triggered. You can customize the expiration by passing a publicTokenOptions
object to the trigger function.
See our triggering documentation for detailed examples of how to trigger tasks and get auto-generated tokens.