This guide will help you understand how to authenticate your requests with Drivly’s APIs. The Drivly API ecosystem uses both API Keys, and JSON Web Tokens (JWT) for authentication.Documentation Index
Fetch the complete documentation index at: https://docs.driv.ly/llms.txt
Use this file to discover all available pages before exploring further.
API Keys vs. JWT Tokens
API Keys should be treated like a password for your account. They can be used to grant access to all the resources in your account. They are powerful, and must be kept secret. JWT Tokens, on the other hand, are used to authenticate a specific user. They have an expiration time, and permissions are baked into the token itself to prevent unauthorized access.API Keys
For security purposes, you cannot create API Keys via the API. However, you can create them in the Drivly dashboard. Once you’ve created an API key, you can use it to authenticate your requests by including it in theAuthorization header.
Using an API Key
JWT Tokens
JWT Tokens are used to authenticate a specific user. You can create a JWT Token by sending a POST request to the/auth endpoint.
Creating a JWT Token
JWT Response
JWT Token Parameters
An array of permissions that the token should have. Any permission ending in
.read will grant GET access to the resource, while any permission ending in
.write will grant POST, PUT, and DELETE access to the resource.
The expiration date of the token. After this date, the token will no longer be valid.By default, this will be set to 1 year from the current date.
User Sessions
If you use our JS SDK, you wont need to worry about refreshing user sessions.
The SDK will automatically handle this for you.
/auth endpoint, where they can log in and grant your application access to their account.
Creating a user session
Response
User is redirected
Managing a User Session
The JWT Token can be used to make requests, while the refresh token is used to fetch a new JWT once the current one expires.The JWT is only valid for 10 minutes after creation, however the refresh token
lasts forever.
Refreshing a JWT Token
Response