managarten/apps-archived/maerchenzauber/apps/backend/test/supabase-auth-integration-test.ts
Till-JS 61d181fbc2 chore: archive inactive projects to apps-archived/
Move inactive projects out of active workspace:
- bauntown (community website)
- maerchenzauber (AI story generation)
- memoro (voice memo app)
- news (news aggregation)
- nutriphi (nutrition tracking)
- reader (reading app)
- uload (URL shortener)
- wisekeep (AI wisdom extraction)

Update CLAUDE.md documentation:
- Add presi to active projects
- Document archived projects section
- Update workspace configuration

Archived apps can be re-activated by moving back to apps/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 07:03:59 +01:00

42 lines
1.3 KiB
TypeScript

import { NestFactory } from '@nestjs/core';
import { AppModule } from '../src/app.module';
import { AuthService } from '../src/core/services/auth.service';
async function testSupabaseAuthIntegration() {
// Create a NestJS application instance
const app = await NestFactory.createApplicationContext(AppModule);
try {
// Get the AuthService
const authService = app.get(AuthService);
// Test user data
const userId = 'test-user-id';
const email = 'test@example.com';
// Generate a Supabase-compatible token
const token = await authService.generateSupabaseCompatibleToken(userId, email);
console.log('Generated Supabase-compatible token:', token);
// Create an authenticated Supabase client
const supabaseClient = authService.getAuthenticatedClient(token);
// Test a simple query to verify authentication
const { data, error } = await supabaseClient.from('your_table_name').select('*').limit(1);
if (error) {
console.error('Error querying Supabase with the token:', error);
} else {
console.log('Successfully authenticated with Supabase! Sample data:', data);
}
} catch (error) {
console.error('Test failed:', error);
} finally {
await app.close();
}
}
// Run the test
testSupabaseAuthIntegration()
.then(() => console.log('Test completed'))
.catch((err) => console.error('Test error:', err));