User Model
TheUser
model in Nile Auth defines the structure of a user object. It includes both basic and custom properties to meet the needs of your application.
User Properties
Basic Properties
- Email: The user’s email address. This is true across all users of a database
- Profile information: Includes details like the user’s name, contact info, and other relevant data, along with any tenants the user is associated.
User Operations
Creating Users
To create a new user, you can make a POST request to the/users
endpoint.
Adding users
When a user is created, they are not automatically added to a tenant, unlessnewTenant
is present. Users can only add other users to tenants of which they are a member. To add a user to a tenant, use linkUser
Updating Users
Because users are isolated to their own session, existing user update themselves viaPUT
method. A custom endpoint would need to be created in order for one user to update the information of another.
Deleting Users
Because user accounts are isolated, one user is unable to delete another. It is possible remove a user from a tenant from the built-in API. In order to to that, useunlinkUser
User Authentication
Password-based Authentication
Password-based authentication is not recommended for production applications. Use social authentication or other secure methods instead.