Auth
The API token:
Log Harvestor API utilizes JSON Web Tokens (JWT) for authentication. Both users and forwarders utilize these tokens for sending requests. The users use the tokens to access their own data, while forwarders use the tokens to send data to Log harvestor.
Obtaining an API token:
Token usage:
{ Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...." }
Token permissions:
Important:
Sign in
Description
This endpoint generates a user token returns a token that can be used to access the API.
Parameters
body
string
Required
Description:
Example:
"ljack21@logharvestor.com"
password
string
Required
Description:
Example:
"password"
Responses
200
OK
Type:
UserAuthRes object
Example:
1 2 3 4 5 6
{ _id: "0f9c0b0b4f0c6b0017f0e3b1", token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", role: "demo", email: "ljack21@logharvestor.com" }
401
Unauthorized
Type:
Error object
Example:
1 2 3 4 5
{ name: "Invalid Credentials", message: "Invalid email or password", status: 401 }
500
Internal Server Error
Type:
Error object
Example:
1 2 3 4 5
{ name: "Internal Server Error", message: "Internal Server Error", status: 500 }
post
/auth/signin
Request
1 2 3 4 5
curl https://logharvestor.com/api/v1/auth/signin \ -X POST \ \ -H 'Content-Type: application/json' \ --data-raw '{"email":"\"ljack21@logharvestor.com\"","password":"\"password\""}'
Response
1 2 3 4 5 6
{ _id: "0f9c0b0b4f0c6b0017f0e3b1", token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", role: "demo", email: "ljack21@logharvestor.com" }
Refresh token
Description
This endpoint generates a new user token from a valid, non-expired users token.
Once a users token is expired, it can no longer be refreshed and instead, a new token must be generated via the sign-in endpoint.
A refresh token returns a new users token that will replace the old one. The old token will no longer be valid.
The new token is utilized in the same way the previous token is utilized.
Parameters
headers
Authorization
string
Required
Description:
Bearer token - JWT
Example:
"Bearer <token>"
Responses
200
OK
Type:
UserAuthRes object
Example:
1 2 3 4 5 6
{ _id: "0f9c0b0b4f0c6b0017f0e3b1", token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", role: "demo", email: "ljack21@logharvestor.com" }
401
Unauthorized
Type:
Error object
Example:
1 2 3 4 5
{ name: "Invalid Token", message: "Invalid Authorization token", status: 401 }
500
Internal Server Error
Type:
Error object
Example:
1 2 3 4 5
{ name: "Internal Server Error", message: "Internal Server Error", status: 500 }
post
/auth/token/refresh
Request
1 2 3 4
curl https://logharvestor.com/api/v1/auth/token/refresh \ -X POST \ -H 'Authorization: Bearer <token>' \
Response
1 2 3 4 5 6
{ _id: "0f9c0b0b4f0c6b0017f0e3b1", token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", role: "demo", email: "ljack21@logharvestor.com" }
Validate token
Description
This endpoint validates a usertoken.
A valid token must meet the following criteria:
Parameters
headers
Authorization
string
Required
Description:
Bearer token - JWT
Example:
"Bearer <token>"
Responses
200
OK
Type:
Boolean object
Example:
1
"true"
401
Unauthorized
Type:
Error object
Example:
1 2 3 4 5
{ name: "Invalid Token", message: "Invalid Authorization token", status: 401 }
500
Internal Server Error
Type:
Error object
Example:
1 2 3 4 5
{ name: "Internal Server Error", message: "Internal Server Error", status: 500 }
post
/auth/token/validate
Request
1 2 3 4
curl https://logharvestor.com/api/v1/auth/token/validate \ -X POST \ -H 'Authorization: Bearer <token>' \
Response
1
"true"
Resources
Docs
Pricing
Roadmap
About
Integrations
Copyright © Log Harvestor 2023 • Terms • Privacy