sojorn/sojorn_docs/archive/verify_supabase_env.ps1

48 lines
2 KiB
PowerShell

# Verify Supabase configuration across all environments
Write-Host "=== Checking Supabase Configuration ===" -ForegroundColor Cyan
Write-Host ""
# 1. Check .env file
Write-Host "1. Checking .env file..." -ForegroundColor Yellow
$envFile = Get-Content "c:\Webs\Sojorn\.env" | Select-String "SUPABASE_URL|SUPABASE_ANON_KEY"
$envFile | ForEach-Object {
$line = $_.Line
if ($line -match "SUPABASE_URL=(.+)") {
Write-Host " URL: $($matches[1])"
}
if ($line -match "SUPABASE_ANON_KEY=(.+)") {
$key = $matches[1]
Write-Host " Anon Key (first 50): $($key.Substring(0, 50))..."
# Decode JWT header
$header = $key.Split('.')[0]
# Add padding if needed
while ($header.Length % 4 -ne 0) { $header += '=' }
$decoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($header))
Write-Host " Algorithm in anon key: $decoded" -ForegroundColor Green
}
}
Write-Host ""
# 2. Check run_dev.ps1
Write-Host "2. Checking run_dev.ps1..." -ForegroundColor Yellow
$runDevFile = Get-Content "c:\Webs\Sojorn\sojorn\run_dev.ps1" | Select-String "dart-define"
Write-Host " Found $($runDevFile.Count) --dart-define flags"
Write-Host ""
# 3. Instructions
Write-Host "=== Next Steps ===" -ForegroundColor Cyan
Write-Host ""
Write-Host "The anon key algorithm should show: {""alg"":""HS256""..." -ForegroundColor Yellow
Write-Host ""
Write-Host "If it shows ES256 instead, then:" -ForegroundColor Yellow
Write-Host " 1. Your Supabase project has been upgraded to use ES256" -ForegroundColor Yellow
Write-Host " 2. This is NORMAL and CORRECT for newer Supabase projects" -ForegroundColor Yellow
Write-Host " 3. The issue is that supabase-js should handle this automatically" -ForegroundColor Yellow
Write-Host ""
Write-Host "Go to: https://app.supabase.com/project/zwkihedetedlatyvplyz/settings/api" -ForegroundColor Green
Write-Host "Copy the CURRENT anon key and paste it here to compare" -ForegroundColor Green
Write-Host ""