Overview
Crow supports three authentication methods for API integrations:| Auth Type | Use Case | Token Source |
|---|---|---|
| API Key | Server-to-server authentication with a static key | Configured in Crow dashboard |
| Bearer Token | Static token-based authentication | Configured in Crow dashboard |
| JWT Forward | Per-user authentication using identity tokens | Forwarded from widget user |
API Key Authentication
Use API Key authentication when your backend expects a static API key in a custom header.When to Use
- Your API uses a simple API key for authentication
- The key should be sent in a custom header (e.g.,
X-API-Key,Api-Key) - All requests from Crow should use the same credentials
OpenAPI Specification
Crow Configuration
In the Crow dashboard under Integrations > API Connection:- Select API Key as the authentication type
- Enter your API key
- Specify the header name (e.g.,
X-API-Key)
How It Works
Bearer Token Authentication
Use Bearer Token authentication when your backend expects a static token in theAuthorization header.
When to Use
- Your API uses OAuth 2.0 or similar token-based authentication
- You have a long-lived access token or service account token
- The token should be sent as
Authorization: Bearer <token>
OpenAPI Specification
Crow Configuration
In the Crow dashboard under Integrations > API Connection:- Select Bearer Token as the authentication type
- Enter your bearer token
How It Works
Authorization header.
JWT Forward Authentication
Use JWT Forward when you need your API to know which end-user is making the request. This is the most powerful authentication method, enabling personalized actions like “cancel my subscription” or “show my orders.”When to Use
- Your API endpoints are user-specific (e.g.,
/my/orders,/account/settings) - You need to verify the identity of the end-user making the request
- You want to perform actions on behalf of a specific user
- You’re already using Crow’s identity verification feature
How It Works
Widget Integration
The Crow widget is embedded via a script tag:OpenAPI Specification
Crow Configuration
In the Crow dashboard under Integrations > API Connection:- Select JWT Forward (User Identity) as the authentication type
- No additional configuration needed—the token comes from the widget user
Backend Implementation
Your API endpoints need to verify the JWT and extract the user identity:Important Notes
- Anonymous Users: When JWT Forward is configured, API tools are only available to authenticated widget users. Anonymous users will not see these tools. This is by design—there’s no user identity to forward for anonymous users.
-
Token Expiration: Crow does not check token expiration before forwarding. Your API should validate the token and return a
401error if expired. The widget should refresh tokens before they expire. - Same Secret: Use the same verification secret in your API that you configured in Crow. This is the secret you use to sign identity tokens for the widget.
- Security: Since your backend signed the JWT originally, you can trust it when it comes back. The token hasn’t been modified because only you have the secret to sign valid tokens.
Choosing the Right Authentication Method
| Scenario | Recommended Auth Type |
|---|---|
| Simple server-to-server integration | API Key |
| Using OAuth access token / service account | Bearer Token |
| User-specific actions (orders, subscriptions, settings) | JWT Forward |
| Mixed: some endpoints need user identity, some don’t | JWT Forward (design your API to handle both) |
Complete OpenAPI Example with JWT Forward
Here’s a full example of an OpenAPI specification for a customer support API that uses JWT Forward authentication:Troubleshooting
”401 Unauthorized” errors
- Check your verification secret: Ensure your API uses the same secret that’s configured in Crow
- Check token expiration: The JWT may have expired; verify the
expclaim - Check the algorithm: Crow uses HS256 for signing identity tokens
API tools not showing for users
- JWT Forward + Anonymous users: If using JWT Forward, anonymous users won’t see API tools. This is expected behavior.
- Check tool selection: Ensure the tools are selected/enabled in the Crow dashboard
Token not being forwarded
- Verify auth type: Confirm “JWT Forward (User Identity)” is selected in the dashboard
- Check identity token: Ensure the widget is receiving a valid identity token from your frontend
”404 Not Found” errors on API calls
Common cause: Duplicate path prefix If your API calls are hitting URLs like/api/api/users instead of /api/users, you have a path duplication issue.
The Problem:
- Your Base URL in Crow is set to:
https://api.example.com/api - Your OpenAPI paths include:
/api/users - Result:
https://api.example.com/api+/api/users=/api/api/users
Summary
| Auth Type | Header Sent | Token Source | User-Specific |
|---|---|---|---|
| API Key | X-API-Key: <key> | Dashboard config | No |
| Bearer Token | Authorization: Bearer <token> | Dashboard config | No |
| JWT Forward | Authorization: Bearer <jwt> | Widget user’s identity token | Yes |
