Restructure progress

This commit is contained in:
Roman Krček
2025-07-08 12:07:43 +02:00
parent 635f507e23
commit ed317feae7
32 changed files with 257 additions and 594 deletions

View File

@@ -1,6 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { getOAuthClient } from '$lib/google/server.js';
import { googleAuthServer } from '$lib/google/server.ts';
export const POST: RequestHandler = async ({ request }) => {
try {
@@ -10,7 +10,7 @@ export const POST: RequestHandler = async ({ request }) => {
return json({ error: 'Refresh token is required' }, { status: 400 });
}
const oauth = getOAuthClient();
const oauth = googleAuthServer.getOAuthClient();
oauth.setCredentials({ refresh_token: refreshToken });
const { credentials } = await oauth.refreshAccessToken();

View File

@@ -1,6 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { getOAuthClient } from '$lib/google/server.js';
import { googleAuthServer } from '$lib/google/server.ts';
import { google } from 'googleapis';
export const GET: RequestHandler = async ({ request }) => {
@@ -14,7 +14,7 @@ export const GET: RequestHandler = async ({ request }) => {
const accessToken = authHeader.slice(7);
// Create OAuth client with the token
const oauth = getOAuthClient();
const oauth = googleAuthServer.getOAuthClient();
oauth.setCredentials({ access_token: accessToken });
// Call the userinfo endpoint to get user details