How to Create an Actor Type
In this document, learn how to create an actor type and authenticate its associated data model.
Test Custom Actor Type Authentication Flow#
To authenticate managers:
- Send a
POSTrequest to/auth/manager/emailpass/registerto create an auth identity for the manager:
curl -X POST 'http://localhost:9000/auth/manager/emailpass/register' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "manager@gmail.com",
"password": "supersecret"
}'
Copy the returned token to use it in the next request.
- Send a
POSTrequest to/managerto create a manager:
curl -X POST 'http://localhost:9000/manager' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {token}' \
--data-raw '{
"first_name": "John",
"last_name": "Doe",
"email": "manager@gmail.com"
}'
Replace {token} with the token returned in the previous step.
- Send a
POSTrequest to/auth/manager/emailpassagain to retrieve an authenticated token for the manager:
curl -X POST 'http://localhost:9000/auth/manager/emailpass' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "manager@gmail.com",
"password": "supersecret"
}'
- You can now send authenticated requests as a manager. For example, send a
GETrequest to/manager/meto retrieve the authenticated manager’s details:
Whenever you want to log in as a manager, use the /auth/manager/emailpass API route, as explained in step 3.