-
Notifications
You must be signed in to change notification settings - Fork 66
add server auth docs #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
add server auth docs #263
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Server Authentication | ||
|
|
||
| When configuring webhooks for your assistant, you can authenticate your server endpoints using either a secret token, custom headers, or OAuth2. This ensures that only authorized requests from Vapi are processed by your server. | ||
|
|
||
| ## Credential Configuration | ||
|
|
||
| Credentials can be configured at multiple levels: | ||
|
|
||
| 1. **Tool Call Level**: Create individual credentials for each tool call | ||
| 2. **Assistant Level**: Set credentials directly in the assistant configuration | ||
| 3. **Phone Number Level**: Configure credentials for specific phone numbers | ||
| 4. **Organization Level**: Manage credentials in the [API Keys page](https://dashboard.vapi.ai/keys) | ||
|
|
||
| The order of precedence is: | ||
| 1. Tool call-level credentials | ||
| 2. Assistant-level credentials | ||
| 3. Phone number-level credentials | ||
| 4. Organization-level credentials from the API Keys page | ||
|
|
||
| ## Authentication Methods | ||
|
|
||
| ### Secret Token Authentication | ||
|
|
||
| The simplest way to authenticate webhook requests is using a secret token. Vapi will include this token in the `X-Vapi-Signature` header of each request. | ||
|
|
||
| #### Configuration | ||
|
|
||
| ```json | ||
| { | ||
| "server": { | ||
| "url": "https://your-server.com/webhook", | ||
| "secret": "your-secret-token" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Custom Headers Authentication | ||
|
|
||
| For more complex authentication scenarios, you can configure custom headers that Vapi will include with each webhook request. | ||
|
|
||
| #### Configuration | ||
|
|
||
| ```json | ||
| { | ||
| "server": { | ||
| "url": "https://your-server.com/webhook", | ||
| "headers": { | ||
| "Authorization": "Bearer your-api-key", | ||
| "Custom-Header": "custom-value" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### OAuth2 Authentication | ||
|
|
||
| For OAuth2-protected webhook endpoints, you can configure OAuth2 credentials that Vapi will use to obtain and refresh access tokens. | ||
|
|
||
| #### Configuration | ||
|
|
||
| ```json | ||
| { | ||
| "server": { | ||
| "url": "https://your-server.com/webhook" | ||
| }, | ||
| "credentials": { | ||
| "webhook": { | ||
| "type": "oauth2", | ||
| "clientId": "your-client-id", | ||
| "clientSecret": "your-client-secret", | ||
| "tokenUrl": "https://your-server.com/oauth/token", | ||
| "scope": "optional, only needed to specify which scopes to request access for" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### OAuth2 Flow | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can add examples around the response format as well. |
||
|
|
||
| 1. Vapi makes a request to your token endpoint with client credentials | ||
| 2. Your server validates the credentials and returns an access token | ||
| 3. Vapi includes the access token in the Authorization header for webhook requests | ||
| 4. Your server validates the access token before processing the webhook | ||
| 5. When the token expires, Vapi automatically requests a new one | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a JWT Authentication as well https://docs.vapi.ai/customization/jwt-authentication
We can migrate it into one documentation.