Authenticate a trusted client with an API key, then verify that it can access the intended project.
Steps
- Create an API key in Studio for the client.
- Store it in a secret manager or local environment file excluded from source control.
- Send it as
Authorization: Bearer <API_KEY>on each request. - Confirm access with a read request before using operations that change resources.
Keep API keys server-side. A browser client should call a backend that holds the key.
Try it with REST
GET /projects
export VERYFRONT_API_KEY="<API_KEY>"
curl --silent --show-error --fail-with-body \
https://api.veryfront.com/projects \
-H "Authorization: Bearer $VERYFRONT_API_KEY"Verify
For the REST example, inspect the projects in data. Confirm the intended project is present. A successful request to a different project doesn't prove the access you need.
For a 401, check the key value, its validity, and the header format. For a denied or unavailable project resource, check the project reference and access associated with the credential.
Use the error body to distinguish authentication from request validation or resource errors. Don't log the key while diagnosing a request.
Next
- Manage project access: Review access to project resources.
- REST quickstart: Supply parameters and inspect responses.