nocode
Search…
Auth

Authentication

There are two main ways to let users authenticate with your api
  1. 1.
    Local JWT Auth
  2. 2.
    Auth0

Local JWT Auth

The local JWT Auth is a passwordless auth system that sends and email with a code that users can then use to log in. Make sure you have a Sendgrid API Key in your configs before trying to get a code.
  1. 1.
    Make a post request to /code
1
curl http://localhost:3030/code?email=[email protected]
2
{"success":true}
Copied!
2. Get the code from your email and then do
1
curl --location --request POST 'http://localhost:3030/auth' \
2
--header 'Authorization: 150812556228bdf005292ead677bd737ae5f82a057062340f9de947f4be6ec66607e4ded613a3f69b6c5730450c07c4c' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"email": "[email protected]", "code": 755326
6
}'
Copied!
You'll get a response like
1
{
2
"success": true,
3
"user": {
4
"id": 1,
5
"email": "[email protected]",
6
"role": "admin",
7
"photo": null,
8
"name": null,
9
"code": 0,
10
"expires": "2020-07-22T01:45:38.000Z",
11
"createdAt": "2020-07-22T01:37:05.000Z",
12
"updatedAt": {
13
"fn": "now",
14
"args": []
15
},
16
"authorId": null
17
},
18
"token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
19
"expiresAt": 1631382161439
20
}
Copied!
You can now make authenticated API calls with the token
Last modified 1yr ago