Skip to main content
An authentication guard connects login to one of your collections. A project can have several guards, for example customers for your shop and staff for your back office, each with its own users, roles, and settings.
The guard slug appears in auth URLs: /auth/customers/login, /auth/staff/login.

Create a guard

1

Prepare the collection

Make sure it has a field to log in with, such as email, username, or phone. Mark that field unique.
2

Create the guard

Go to Authentication → Guards → Create guard. Enter a name (the slug is generated from it), pick the collection, and pick the login field.
3

Review what Bludia adds

  • A password field on the collection, if it doesn’t have one. Values are hashed and never returned.
  • A default role named User (slug user), assigned automatically to everyone who registers.

Settings

Custom login fields

The login field can be any field on the collection. Users always send it as login when logging in:
When registering, send it under its field name instead, for example { "email": "…", "password": "…" }.
Add a format rule (email or phone) and unique to the login field so bad or duplicate values are rejected.

Multiple guards

Use more than one guard when groups of users are truly separate: different collections, sign-up rules, or token lifetimes. Use roles within one guard when they’re the same kind of user with different access, such as user and admin.

Social login

Guards can store identity provider settings (client ID and secret per provider). Social sign-in flows are not available yet during the beta.