Upgraded to Next Auth v5

This commit is contained in:
Tom
2024-01-02 07:26:20 +00:00
parent a3352af981
commit 4505654a05
24 changed files with 283 additions and 227 deletions

View File

@ -1,7 +1,6 @@
import axios from 'axios'
import { db } from "@/lib/db"
import { NextResponse } from "next/server";
import { GET as authorize } from '../authorize/route'
export async function GET(req: Request) {
try {
@ -11,7 +10,6 @@ export async function GET(req: Request) {
id: req.headers.get('x-api-key') as string
}
})
if (!key) {
return new NextResponse("Forbidden", { status: 403 });
}
@ -46,9 +44,6 @@ export async function GET(req: Request) {
// Fetch values from token.
const { access_token, expires_in, refresh_token, token_type } = token
// console.log("AT", access_token)
// console.log("RT", refresh_token)
// console.log("TT", token_type)
if (!access_token || !refresh_token || token_type !== "bearer") {
return new NextResponse("Unauthorized", { status: 401 });