Upgraded to Next Auth v5
This commit is contained in:
@ -9,9 +9,6 @@ export async function GET(req: Request) {
|
||||
const scope = searchParams.get('scope') as string
|
||||
const state = searchParams.get('state') as string
|
||||
|
||||
console.log("CODE:", code)
|
||||
console.log("SCOPE:", scope)
|
||||
console.log("STATE:", state)
|
||||
if (!code || !scope || !state) {
|
||||
return new NextResponse("Bad Request", { status: 400 });
|
||||
}
|
||||
@ -38,21 +35,17 @@ 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 });
|
||||
}
|
||||
|
||||
let info = await axios.get("https://api.twitch.tv/helix/users?login=" + user.username, {
|
||||
let info = await axios.get("https://api.twitch.tv/helix/users?login=" + user.name, {
|
||||
headers: {
|
||||
"Authorization": "Bearer " + access_token,
|
||||
"Client-Id": process.env.TWITCH_BOT_CLIENT_ID
|
||||
}
|
||||
})
|
||||
console.log(info.data.data)
|
||||
const broadcasterId = info.data.data[0]['id']
|
||||
|
||||
await db.twitchConnection.create({
|
||||
|
Reference in New Issue
Block a user