@jmruthers/pace-core 0.5.147 → 0.5.149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DataTable-VWAHYZAB.js → DataTable-6G3KTRE2.js} +3 -3
- package/dist/{chunk-MYLOSYK5.js → chunk-I63KPRGZ.js} +58 -29
- package/dist/chunk-I63KPRGZ.js.map +1 -0
- package/dist/{chunk-B6R63NR5.js → chunk-RF6SUNXB.js} +2 -2
- package/dist/{chunk-M57AT6C2.js → chunk-XXFXL7A5.js} +2 -2
- package/dist/{chunk-GROECFVN.js → chunk-ZEPHPGHZ.js} +3 -3
- package/dist/components.js +3 -3
- package/dist/index.js +4 -4
- package/dist/rbac/index.js +2 -2
- package/dist/utils.js +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +2 -2
- package/docs/rbac/RBAC_LOGIN_SAFETY_FIX.md +95 -0
- package/docs/troubleshooting/DEBUG_NETWORK_ERROR.md +152 -0
- package/docs/troubleshooting/FIX_SUPABASE_CORS.md +184 -0
- package/package.json +1 -1
- package/src/rbac/hooks/useRBAC.ts +68 -29
- package/dist/chunk-MYLOSYK5.js.map +0 -1
- /package/dist/{DataTable-VWAHYZAB.js.map → DataTable-6G3KTRE2.js.map} +0 -0
- /package/dist/{chunk-B6R63NR5.js.map → chunk-RF6SUNXB.js.map} +0 -0
- /package/dist/{chunk-M57AT6C2.js.map → chunk-XXFXL7A5.js.map} +0 -0
- /package/dist/{chunk-GROECFVN.js.map → chunk-ZEPHPGHZ.js.map} +0 -0
package/docs/api/modules.md
CHANGED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# RBAC Login Safety Fix - v0.5.148
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
After RBAC changes, users reported login failures. Investigation revealed:
|
|
6
|
+
1. **CORS error** - Network/infrastructure issue (separate from RBAC)
|
|
7
|
+
2. **Potential hook errors** - `useOrganisations()` might throw when called before authentication
|
|
8
|
+
|
|
9
|
+
## Root Cause
|
|
10
|
+
|
|
11
|
+
`useRBAC` hook calls `useOrganisations()` unconditionally (required by React hooks rules). If `useOrganisations()` throws an error when there's no authenticated user, it could break the login flow.
|
|
12
|
+
|
|
13
|
+
## Fix Applied
|
|
14
|
+
|
|
15
|
+
Wrapped `useOrganisations()` call in try-catch, similar to how `useEvents()` is handled:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// Safely get organisation context - may not be available during login
|
|
19
|
+
let selectedOrganisation: { id: string } | null = null;
|
|
20
|
+
let orgContextReady = false;
|
|
21
|
+
let orgLoading = false;
|
|
22
|
+
try {
|
|
23
|
+
const orgContext = useOrganisations();
|
|
24
|
+
selectedOrganisation = orgContext.selectedOrganisation;
|
|
25
|
+
orgContextReady = orgContext.isContextReady;
|
|
26
|
+
orgLoading = orgContext.isLoading;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// Organisation provider not available or user not authenticated - this is OK
|
|
29
|
+
logger.debug('[useRBAC] Organisation provider not available, continuing without organisation context', error);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Safety Guarantees
|
|
34
|
+
|
|
35
|
+
1. ✅ **`useRBAC` never throws** - All hook calls are wrapped in try-catch
|
|
36
|
+
2. ✅ **Safe during login** - Returns empty state when unauthenticated
|
|
37
|
+
3. ✅ **Early returns** - Exits immediately if no user/session
|
|
38
|
+
4. ✅ **No logging noise** - Only logs when authenticated
|
|
39
|
+
5. ✅ **No network calls** - Doesn't make RPC calls when unauthenticated
|
|
40
|
+
|
|
41
|
+
## Verification
|
|
42
|
+
|
|
43
|
+
### When Unauthenticated:
|
|
44
|
+
- `useRBAC` returns safely with empty state
|
|
45
|
+
- No errors thrown
|
|
46
|
+
- No network calls made
|
|
47
|
+
- Login flow proceeds normally
|
|
48
|
+
|
|
49
|
+
### When Authenticated:
|
|
50
|
+
- `useRBAC` loads organisation context
|
|
51
|
+
- Waits for organisation context before loading RBAC
|
|
52
|
+
- Loads permissions correctly
|
|
53
|
+
|
|
54
|
+
## CORS Error (Separate Issue)
|
|
55
|
+
|
|
56
|
+
The CORS error is **NOT caused by RBAC**. It's a network/infrastructure issue:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
|
|
60
|
+
at https://srqhjwivpohjcjqikjry.supabase.co/auth/v1/token?grant_type=password
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### To Fix CORS:
|
|
64
|
+
1. Check Supabase Dashboard → Settings → API → CORS
|
|
65
|
+
2. Add `localhost:8087` to allowed origins
|
|
66
|
+
3. Or use wildcard `*` for development
|
|
67
|
+
4. Check network/proxy settings
|
|
68
|
+
5. Verify browser isn't blocking requests
|
|
69
|
+
|
|
70
|
+
## Testing
|
|
71
|
+
|
|
72
|
+
1. **Before login**:
|
|
73
|
+
- Open browser console
|
|
74
|
+
- Navigate to login page
|
|
75
|
+
- Verify no RBAC errors
|
|
76
|
+
- Verify login form displays
|
|
77
|
+
|
|
78
|
+
2. **During login**:
|
|
79
|
+
- Enter credentials
|
|
80
|
+
- Click login
|
|
81
|
+
- Verify no RBAC errors in console
|
|
82
|
+
- If CORS error appears, it's a Supabase config issue (not RBAC)
|
|
83
|
+
|
|
84
|
+
3. **After login**:
|
|
85
|
+
- Verify RBAC loads correctly
|
|
86
|
+
- Check console for RBAC loading logs
|
|
87
|
+
- Verify permissions load
|
|
88
|
+
|
|
89
|
+
## Summary
|
|
90
|
+
|
|
91
|
+
- ✅ **RBAC is now safe** - Wrapped in try-catch, won't break login
|
|
92
|
+
- ✅ **No interference** - Early returns prevent any action when unauthenticated
|
|
93
|
+
- ⚠️ **CORS is separate** - Infrastructure issue, needs Supabase config fix
|
|
94
|
+
- ✅ **Ready for testing** - Should work correctly now
|
|
95
|
+
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Debugging NetworkError / CORS Error
|
|
2
|
+
|
|
3
|
+
## The Real Issue
|
|
4
|
+
|
|
5
|
+
If pace-cake works fine with the same Supabase instance, then **CORS is already configured correctly**. The "CORS request did not succeed" error message is often misleading - it usually means the request failed for another reason, not necessarily CORS policy.
|
|
6
|
+
|
|
7
|
+
## How to Debug
|
|
8
|
+
|
|
9
|
+
### Step 1: Check Network Tab in Browser DevTools
|
|
10
|
+
|
|
11
|
+
1. Open browser DevTools (F12 or Cmd+Option+I)
|
|
12
|
+
2. Go to **Network** tab
|
|
13
|
+
3. Clear the network log
|
|
14
|
+
4. Try to log in
|
|
15
|
+
5. Look for the failed request to `/auth/v1/token`
|
|
16
|
+
|
|
17
|
+
**What to check:**
|
|
18
|
+
- **Status code**: What HTTP status code is returned? (200, 401, 500, etc.)
|
|
19
|
+
- **Request headers**: Are the headers correct?
|
|
20
|
+
- **Response**: What does the response say?
|
|
21
|
+
- **Timing**: Does the request timeout or fail immediately?
|
|
22
|
+
|
|
23
|
+
### Step 2: Check Console for Real Error
|
|
24
|
+
|
|
25
|
+
The browser console might show the actual error. Look for:
|
|
26
|
+
- Network timeout
|
|
27
|
+
- Connection refused
|
|
28
|
+
- SSL/TLS errors
|
|
29
|
+
- Proxy errors
|
|
30
|
+
- Request cancelled
|
|
31
|
+
|
|
32
|
+
### Step 3: Compare with pace-cake
|
|
33
|
+
|
|
34
|
+
Since pace-cake works:
|
|
35
|
+
1. **Check pace-cake's network tab** - What does a successful login request look like?
|
|
36
|
+
2. **Compare request headers** - Are they the same?
|
|
37
|
+
3. **Compare Supabase client setup** - Is it identical?
|
|
38
|
+
|
|
39
|
+
### Step 4: Check for Differences
|
|
40
|
+
|
|
41
|
+
**Compare pace-trac vs pace-cake:**
|
|
42
|
+
|
|
43
|
+
1. **Supabase client creation**:
|
|
44
|
+
```typescript
|
|
45
|
+
// pace-trac - check this matches pace-cake
|
|
46
|
+
const supabase = createClient(url, key, {
|
|
47
|
+
auth: {
|
|
48
|
+
autoRefreshToken: true,
|
|
49
|
+
persistSession: true,
|
|
50
|
+
detectSessionInUrl: true
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. **setupRBAC call**:
|
|
56
|
+
```typescript
|
|
57
|
+
// Should be identical
|
|
58
|
+
setupRBAC(supabase);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
3. **Provider setup**:
|
|
62
|
+
```typescript
|
|
63
|
+
// Should match pace-cake exactly
|
|
64
|
+
<UnifiedAuthProvider supabaseClient={supabase} appName={APP_NAME}>
|
|
65
|
+
<OrganisationProvider>
|
|
66
|
+
<App />
|
|
67
|
+
</OrganisationProvider>
|
|
68
|
+
</UnifiedAuthProvider>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 5: Check Browser/Network Issues
|
|
72
|
+
|
|
73
|
+
**Common causes of "CORS request did not succeed":**
|
|
74
|
+
|
|
75
|
+
1. **Browser extension blocking requests**
|
|
76
|
+
- Try incognito/private mode
|
|
77
|
+
- Disable extensions one by one
|
|
78
|
+
|
|
79
|
+
2. **Network/proxy issues**
|
|
80
|
+
- Check if corporate proxy is blocking
|
|
81
|
+
- Try different network (mobile hotspot)
|
|
82
|
+
- Check firewall settings
|
|
83
|
+
|
|
84
|
+
3. **DNS issues**
|
|
85
|
+
- Can you reach `srqhjwivpohjcjqikjry.supabase.co`?
|
|
86
|
+
- Try pinging the domain
|
|
87
|
+
|
|
88
|
+
4. **SSL/TLS issues**
|
|
89
|
+
- Check browser console for SSL errors
|
|
90
|
+
- Verify certificate is valid
|
|
91
|
+
|
|
92
|
+
### Step 6: Check pace-trac Specific Issues
|
|
93
|
+
|
|
94
|
+
**Things that might be different in pace-trac:**
|
|
95
|
+
|
|
96
|
+
1. **Port number**: Are you using a different port than pace-cake?
|
|
97
|
+
- pace-cake might use `localhost:3000`
|
|
98
|
+
- pace-trac uses `localhost:8087`
|
|
99
|
+
- But if CORS is configured with wildcard, this shouldn't matter
|
|
100
|
+
|
|
101
|
+
2. **Environment variables**: Are they correct?
|
|
102
|
+
```bash
|
|
103
|
+
# Check these match pace-cake
|
|
104
|
+
VITE_SUPABASE_URL=...
|
|
105
|
+
VITE_SUPABASE_ANON_KEY=...
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
3. **Vite configuration**: Any proxy or network settings?
|
|
109
|
+
```typescript
|
|
110
|
+
// vite.config.ts - check for any proxy settings
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Most Likely Causes
|
|
114
|
+
|
|
115
|
+
Based on "pace-cake works but pace-trac doesn't":
|
|
116
|
+
|
|
117
|
+
1. **Different port** - But CORS should allow both if configured correctly
|
|
118
|
+
2. **Browser session issue** - Try clearing cache/cookies
|
|
119
|
+
3. **Network timing** - Something interfering with the request
|
|
120
|
+
4. **Code difference** - Something in pace-trac setup is different
|
|
121
|
+
|
|
122
|
+
## Quick Fixes to Try
|
|
123
|
+
|
|
124
|
+
1. **Clear browser cache and cookies**
|
|
125
|
+
2. **Try incognito/private mode**
|
|
126
|
+
3. **Try different browser**
|
|
127
|
+
4. **Restart dev server**
|
|
128
|
+
5. **Check if pace-cake still works** (verify Supabase is up)
|
|
129
|
+
|
|
130
|
+
## If Still Failing
|
|
131
|
+
|
|
132
|
+
**Check the actual network request details:**
|
|
133
|
+
- Right-click the failed request in Network tab
|
|
134
|
+
- Select "Copy" → "Copy as cURL"
|
|
135
|
+
- Compare with pace-cake's successful request
|
|
136
|
+
- Look for differences in headers, URL, or body
|
|
137
|
+
|
|
138
|
+
**Check console for actual error:**
|
|
139
|
+
- The "CORS request did not succeed" might be masking the real error
|
|
140
|
+
- Look for other error messages before/after
|
|
141
|
+
- Check if there are multiple failed requests
|
|
142
|
+
|
|
143
|
+
## Summary
|
|
144
|
+
|
|
145
|
+
Since pace-cake works, this is likely:
|
|
146
|
+
- ✅ **NOT a CORS configuration issue** (already configured)
|
|
147
|
+
- ✅ **NOT an RBAC issue** (RBAC doesn't interfere with auth)
|
|
148
|
+
- ⚠️ **Likely a network/browser issue** specific to pace-trac
|
|
149
|
+
- ⚠️ **Or a code difference** between pace-trac and pace-cake
|
|
150
|
+
|
|
151
|
+
**Next step**: Check Network tab in DevTools to see the actual error, not just the CORS message.
|
|
152
|
+
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# How to Fix CORS Error in Supabase
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
You're seeing this error when trying to log in:
|
|
6
|
+
```
|
|
7
|
+
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
|
|
8
|
+
at https://srqhjwivpohjcjqikjry.supabase.co/auth/v1/token?grant_type=password
|
|
9
|
+
(Reason: CORS request did not succeed)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This happens because Supabase is blocking requests from `localhost:8087` due to CORS (Cross-Origin Resource Sharing) policy.
|
|
13
|
+
|
|
14
|
+
## Solution: Add Your Origin to Supabase CORS Settings
|
|
15
|
+
|
|
16
|
+
### Step 1: Log into Supabase Dashboard
|
|
17
|
+
|
|
18
|
+
1. Go to [https://app.supabase.com](https://app.supabase.com)
|
|
19
|
+
2. Log in with your Supabase account
|
|
20
|
+
3. Select your project (the one with URL `srqhjwivpohjcjqikjry.supabase.co`)
|
|
21
|
+
|
|
22
|
+
### Step 2: Navigate to API Settings
|
|
23
|
+
|
|
24
|
+
1. In the left sidebar, click on **"Settings"** (gear icon)
|
|
25
|
+
2. Click on **"API"** in the settings menu
|
|
26
|
+
|
|
27
|
+
### Step 3: Find CORS Settings
|
|
28
|
+
|
|
29
|
+
Look for one of these sections (Supabase UI may vary):
|
|
30
|
+
|
|
31
|
+
**Option A: "CORS" Section**
|
|
32
|
+
- Scroll down to find **"CORS"** or **"Allowed Origins"** section
|
|
33
|
+
- You'll see a text area or input field for allowed origins
|
|
34
|
+
|
|
35
|
+
**Option B: "Additional Configuration"**
|
|
36
|
+
- Look for **"Additional Configuration"** or **"Advanced Settings"**
|
|
37
|
+
- Find **"CORS Origins"** or **"Allowed Origins"**
|
|
38
|
+
|
|
39
|
+
**Option C: "Auth" Settings**
|
|
40
|
+
- Sometimes CORS is under **"Auth"** → **"URL Configuration"**
|
|
41
|
+
- Look for **"Site URL"** or **"Redirect URLs"** sections
|
|
42
|
+
- CORS might be listed as **"Additional Redirect URLs"** or **"Allowed Origins"**
|
|
43
|
+
|
|
44
|
+
### Step 4: Add Your Development Origin
|
|
45
|
+
|
|
46
|
+
In the CORS/Allowed Origins field, add:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
http://localhost:8087
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**If there are already origins listed**, add yours on a new line or separated by commas:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
http://localhost:3000
|
|
56
|
+
http://localhost:8087
|
|
57
|
+
http://localhost:5173
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**For development, you can also use a wildcard** (less secure, but convenient):
|
|
61
|
+
```
|
|
62
|
+
*
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
⚠️ **Note**: Wildcard (`*`) allows ALL origins. Only use this for development, never in production!
|
|
66
|
+
|
|
67
|
+
### Step 5: Save Changes
|
|
68
|
+
|
|
69
|
+
1. Click **"Save"** or **"Update"** button
|
|
70
|
+
2. Wait for confirmation that settings were saved
|
|
71
|
+
3. Changes may take a few seconds to propagate
|
|
72
|
+
|
|
73
|
+
### Step 6: Test Login
|
|
74
|
+
|
|
75
|
+
1. Go back to your app (`http://localhost:8087`)
|
|
76
|
+
2. Try logging in again
|
|
77
|
+
3. Check browser console - CORS error should be gone
|
|
78
|
+
|
|
79
|
+
## Alternative: Check Project Settings
|
|
80
|
+
|
|
81
|
+
If you can't find CORS settings in API settings:
|
|
82
|
+
|
|
83
|
+
### Method 1: Project Settings → API
|
|
84
|
+
1. Go to **"Project Settings"** (top right, gear icon)
|
|
85
|
+
2. Click **"API"**
|
|
86
|
+
3. Look for **"CORS"** or **"Allowed Origins"**
|
|
87
|
+
|
|
88
|
+
### Method 2: Auth Settings
|
|
89
|
+
1. Go to **"Authentication"** in left sidebar
|
|
90
|
+
2. Click **"URL Configuration"**
|
|
91
|
+
3. Check **"Site URL"** and **"Redirect URLs"**
|
|
92
|
+
4. Add `http://localhost:8087` to redirect URLs if needed
|
|
93
|
+
|
|
94
|
+
### Method 3: Database Settings
|
|
95
|
+
1. Go to **"Settings"** → **"Database"**
|
|
96
|
+
2. Look for **"Connection Pooling"** or **"API"** settings
|
|
97
|
+
3. CORS might be listed there
|
|
98
|
+
|
|
99
|
+
## If CORS Settings Don't Exist
|
|
100
|
+
|
|
101
|
+
Some Supabase projects might not have explicit CORS settings. In that case:
|
|
102
|
+
|
|
103
|
+
### Option 1: Check Site URL
|
|
104
|
+
1. Go to **"Authentication"** → **"URL Configuration"**
|
|
105
|
+
2. Set **"Site URL"** to `http://localhost:8087`
|
|
106
|
+
3. Add `http://localhost:8087` to **"Redirect URLs"**
|
|
107
|
+
|
|
108
|
+
### Option 2: Use Supabase CLI
|
|
109
|
+
If you have Supabase CLI installed:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Update CORS settings via CLI
|
|
113
|
+
supabase projects update <project-id> --cors-origins "http://localhost:8087"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Option 3: Contact Supabase Support
|
|
117
|
+
If you can't find CORS settings anywhere:
|
|
118
|
+
1. Check Supabase documentation for your project version
|
|
119
|
+
2. Contact Supabase support
|
|
120
|
+
3. They can help configure CORS for your project
|
|
121
|
+
|
|
122
|
+
## Production Setup
|
|
123
|
+
|
|
124
|
+
For production, you'll need to:
|
|
125
|
+
|
|
126
|
+
1. **Add your production domain**:
|
|
127
|
+
```
|
|
128
|
+
https://yourdomain.com
|
|
129
|
+
https://www.yourdomain.com
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. **Remove wildcard** (`*`) if you used it for development
|
|
133
|
+
|
|
134
|
+
3. **Set Site URL** in Auth settings to your production URL
|
|
135
|
+
|
|
136
|
+
## Verification
|
|
137
|
+
|
|
138
|
+
After making changes:
|
|
139
|
+
|
|
140
|
+
1. **Clear browser cache** (important!)
|
|
141
|
+
2. **Hard refresh** the page (Ctrl+Shift+R or Cmd+Shift+R)
|
|
142
|
+
3. **Try login again**
|
|
143
|
+
4. **Check browser console** - should see no CORS errors
|
|
144
|
+
|
|
145
|
+
## Common Issues
|
|
146
|
+
|
|
147
|
+
### "Settings saved but still getting CORS error"
|
|
148
|
+
- Wait 30-60 seconds for changes to propagate
|
|
149
|
+
- Clear browser cache
|
|
150
|
+
- Try incognito/private browsing mode
|
|
151
|
+
- Check if you're using the correct origin (http vs https, port number)
|
|
152
|
+
|
|
153
|
+
### "Can't find CORS settings"
|
|
154
|
+
- Supabase UI changes frequently
|
|
155
|
+
- Try searching for "CORS", "origins", or "allowed"
|
|
156
|
+
- Check Supabase documentation for your project version
|
|
157
|
+
- Contact Supabase support
|
|
158
|
+
|
|
159
|
+
### "Works in one browser but not another"
|
|
160
|
+
- Clear cache in both browsers
|
|
161
|
+
- Check browser security settings
|
|
162
|
+
- Try disabling browser extensions
|
|
163
|
+
- Check if one browser has stricter CORS policies
|
|
164
|
+
|
|
165
|
+
## Still Having Issues?
|
|
166
|
+
|
|
167
|
+
If CORS error persists after following these steps:
|
|
168
|
+
|
|
169
|
+
1. **Double-check the origin**: Make sure `http://localhost:8087` matches exactly (including `http://` not `https://`)
|
|
170
|
+
2. **Check network tab**: Open browser DevTools → Network tab, look for the failed request, check request headers
|
|
171
|
+
3. **Verify Supabase project**: Make sure you're editing the correct project (check the URL in error message)
|
|
172
|
+
4. **Check for typos**: Ensure no extra spaces or characters in CORS settings
|
|
173
|
+
5. **Try different port**: If using a different port, add that too: `http://localhost:5173`, `http://localhost:3000`, etc.
|
|
174
|
+
|
|
175
|
+
## Summary
|
|
176
|
+
|
|
177
|
+
1. ✅ Go to Supabase Dashboard → Settings → API
|
|
178
|
+
2. ✅ Find "CORS" or "Allowed Origins" section
|
|
179
|
+
3. ✅ Add `http://localhost:8087`
|
|
180
|
+
4. ✅ Save changes
|
|
181
|
+
5. ✅ Clear browser cache and test
|
|
182
|
+
|
|
183
|
+
The CORS error should be resolved after these steps!
|
|
184
|
+
|