# Best practices and error handling

### Security best practices

* Validate the `state` parameter to prevent CSRF attacks
* Store secrets securely (confidential clients only)
* Implement proper error handling for expired or invalid tokens

### Common scopes

* `openid`: Required for OpenID Connect authentication
* Add other Make-specific scopes as needed for your application

### Error handling

Common error responses from the token endpoint:

<table><thead><tr><th width="252.61328125">Error </th><th>Description</th></tr></thead><tbody><tr><td><code>invalid_request</code></td><td>Missing or invalid parameters</td></tr><tr><td><code>invalid_client</code></td><td>Invalid client credentials</td></tr><tr><td><code>invalid_grant</code></td><td>Invalid or expired authorization code</td></tr><tr><td><code>unsupported_grant_type</code></td><td>Grant type not supported</td></tr></tbody></table>

Always check the response status and handle errors appropriately in your application.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.make.com/api-documentation/authentication/oauth-flow/best-practices-and-error-handling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
