Security fixes to lib files
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { authServer } from '$lib/google/index.js';
|
||||
import { getOAuthClient } from '$lib/google/server.js';
|
||||
|
||||
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 = authServer.getOAuthClient();
|
||||
const oauth = getOAuthClient();
|
||||
oauth.setCredentials({ refresh_token: refreshToken });
|
||||
|
||||
const { credentials } = await oauth.refreshAccessToken();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { authServer } from '$lib/google/index.js';
|
||||
import { getOAuthClient } from '$lib/google/server.js';
|
||||
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 = authServer.getOAuthClient();
|
||||
const oauth = getOAuthClient();
|
||||
oauth.setCredentials({ access_token: accessToken });
|
||||
|
||||
// Call the userinfo endpoint to get user details
|
||||
|
||||
Reference in New Issue
Block a user