Skip to content

Commit 3f24e42

Browse files
committed
add more examples for oauth2 + JWT
1 parent 8ecdc6d commit 3f24e42

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

fern/server-url/server-authentication.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The simplest way to authenticate webhook requests is using a secret token. Vapi
3838

3939
For more complex authentication scenarios, you can configure custom headers that Vapi will include with each webhook request.
4040

41+
This could include short lived JWTs/API Keys passed along via the Authorization header, or any other header that your server checks for.
42+
4143
#### Configuration
4244

4345
```json
@@ -82,3 +84,32 @@ For OAuth2-protected webhook endpoints, you can configure OAuth2 credentials tha
8284
3. Vapi includes the access token in the Authorization header for webhook requests
8385
4. Your server validates the access token before processing the webhook
8486
5. When the token expires, Vapi automatically requests a new one
87+
88+
#### OAuth2 Token Response Format
89+
90+
Your server should return a JSON response with the following format:
91+
92+
```json
93+
{
94+
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
95+
"token_type": "Bearer",
96+
"expires_in": 3600,
97+
"refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA", // Optional
98+
"scope": "read write" // Optional, only if scope was requested
99+
}
100+
```
101+
102+
Example error response:
103+
104+
```json
105+
{
106+
"error": "invalid_client",
107+
"error_description": "Invalid client credentials"
108+
}
109+
```
110+
111+
Common error types:
112+
- `invalid_client`: Invalid client credentials
113+
- `invalid_grant`: Invalid or expired refresh token
114+
- `invalid_scope`: Invalid scope requested
115+
- `unauthorized_client`: Client not authorized for this grant type

0 commit comments

Comments
 (0)