-
Clone the repo with
git clone https://github.com/ltzenteno/auth-api.git
-
Install its dependencies with
npm install
-
Create a Mongo Database and replace it's values in your .env file, for this example I'm using the following url:
DB=mongodb://brave:brave@localhost:27017/bravedb
-
start the server with
npm start
-
create default user executing the following url:
http://localhost:8080/api/setup
(the default user is [email protected]
- hola
)
Now you can authenticate with the following endpoint:
http://localhost:8080/api/authenticate
You have to send the corresponding email and password, if the credentials are correct, you should see the response with the JWT token.
Now, having the token we can call the fetch users endpoint:
http://localhost:8080/api/users
Sending the corresponding token inside the x-access-token
header.