refactor
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import { cookies } from 'next/headers';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { getAuthService } from '../../../../lib/auth';
|
||||
import { apiClient } from '../../../../lib/apiClient';
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const url = new URL(request.url);
|
||||
const returnTo = url.searchParams.get('returnTo') ?? undefined;
|
||||
|
||||
const authService = getAuthService();
|
||||
const { redirectUrl, state } = await authService.startIracingAuthRedirect(returnTo);
|
||||
const redirectUrl = apiClient.auth.getIracingAuthUrl(returnTo);
|
||||
// For now, generate a simple state - in production this should be cryptographically secure
|
||||
const state = Math.random().toString(36).substring(2, 15);
|
||||
|
||||
const cookieStore = await cookies();
|
||||
cookieStore.set('gp_demo_auth_state', state, {
|
||||
|
||||
Reference in New Issue
Block a user