API Authentication
Learn how to authenticate your requests to the UseGrant API.
The UseGrant Rest API uses Bearer tokens for authentication. We recommend beginning with this section to learn how to securely access the API. From there, you can explore the guides and examples for different endpoints and see how they can help you achieve your goals.
To start using the UseGrant Rest API, the first step is to create an API token. To generate a token,
- log in to the app
- navigate to the settings page at
/settings/token
. - provide a name for the token and click on Generate.
Ensure that you store the token securely. For subsequent requests, the client authenticates by including this token in the Authorization
header of HTTP requests, prefixed with "Bearer".
Example:
Note: The token you generate will have the format uga_<token>
.
The uga_
prefix is used to indicate that it is a UseGrant token and it is an API token and you can also use it to identify if the token is accidentally exposed.
If/When the token is expired, you will receive a 401 Unauthorized
response.
In future, if we add more types of tokens, the token prefix will help you identify the nature of the token.
Example
Here is an example of how to include the Bearer token in a curl
request to create a project: