Form submissions to customer website are failing with 500 errors
### The Issue 
Form submissions from www.listwithhyde.com were failing with 500 errors because the CRM couldn't authenticate them. The CRM customer account had:
1. Wrong `client_id` that didn't match any OAuth application
2. Missing or incorrect `api_token`
## The Fix
We updated TWO fields in the CRM `customer_accounts` table:
1. **client_id**: Updated to `7a9d94e2...` (from `oauth_applications.uid` in RealSavvy DB)
2. **api_token**: Updated to the admin-scoped JWT token (from `oauth_access_tokens.token` in RealSavvy DB where scopes='admin') **Where the data comes from:**
- `client_id` = `oauth_applications.uid` (RealSavvy DB)
- `api_token` = `oauth_access_tokens.token` where `scopes='admin'` (RealSavvy DB)### Future Prevention
We should create an automated check that validates BOTH fields:
1. Verify `client_id` matches an existing `oauth_applications.uid`
2. Verify `api_token` is a valid admin token from `oauth_access_tokens`
3. Alert if either field is incorrect or missing**Quick Validation Query** (for devs):
```sql
-- Check if customer accounts have valid OAuth configs
SELECT
ca.id,
ca.name,
CASE WHEN oa.uid IS NULL THEN '
Invalid client_id' ELSE '
Valid' END as client_id_status,
CASE WHEN oat.token IS NULL THEN '
No admin token' ELSE '
Has admin token' END as token_status
FROM db_crm.customer_accounts ca
LEFT JOIN db_realsavvy.oauth_applications oa ON oa.uid = ca.client_id
LEFT JOIN db_realsavvy.oauth_access_tokens oat ON oat.token = ca.api_token AND oat.scopes = 'admin'
WHERE ca.api_token IS NOT NULL;
```
Form submissions from www.listwithhyde.com were failing with 500 errors because the CRM couldn't authenticate them. The CRM customer account had:
1. Wrong `client_id` that didn't match any OAuth application
2. Missing or incorrect `api_token`
## The Fix
We updated TWO fields in the CRM `customer_accounts` table:
1. **client_id**: Updated to `7a9d94e2...` (from `oauth_applications.uid` in RealSavvy DB)
2. **api_token**: Updated to the admin-scoped JWT token (from `oauth_access_tokens.token` in RealSavvy DB where scopes='admin') **Where the data comes from:**
- `client_id` = `oauth_applications.uid` (RealSavvy DB)
- `api_token` = `oauth_access_tokens.token` where `scopes='admin'` (RealSavvy DB)### Future Prevention
We should create an automated check that validates BOTH fields:
1. Verify `client_id` matches an existing `oauth_applications.uid`
2. Verify `api_token` is a valid admin token from `oauth_access_tokens`
3. Alert if either field is incorrect or missing**Quick Validation Query** (for devs):
```sql
-- Check if customer accounts have valid OAuth configs
SELECT
ca.id,
ca.name,
CASE WHEN oa.uid IS NULL THEN '
CASE WHEN oat.token IS NULL THEN '
FROM db_crm.customer_accounts ca
LEFT JOIN db_realsavvy.oauth_applications oa ON oa.uid = ca.client_id
LEFT JOIN db_realsavvy.oauth_access_tokens oat ON oat.token = ca.api_token AND oat.scopes = 'admin'
WHERE ca.api_token IS NOT NULL;
```