Spaces:
Sleeping
Sleeping
test cookie
Browse filesFiles changed (2)
12345672 unmodified lines79808182838485868788899091import { NextRequest, NextResponse } from "next/server";import { cookies } from "next/headers";import MY_TOKEN_KEY from "@/lib/get-cookie-name";
export async function GET() { const redirect_uri = process.env.REDIRECT_URI;72 unmodified lines ); } const user = await userResponse.json(); const cookieStore = await cookies(); cookieStore.set(MY_TOKEN_KEY(), response.access_token, { maxAge: response.expires_in, httpOnly: false, secure: true, sameSite: "none", });
return NextResponse.json( {59 unmodified lines60616263636465666768696465666768697071727359 unmodified lines .post("/auth", { code }) .then(async (res: any) => { if (res.data) { // fix to be able to set the cookie through the space (Hugging Face) setCookie(res.data.access_token, { expires: res.data.expires_in ? new Date(Date.now() + res.data.expires_in * 1000) : undefined, sameSite: "none", secure: false, }); // setCookie(res.data.access_token, { // expires: res.data.expires_in // ? new Date(Date.now() + res.data.expires_in * 1000) // : undefined, // sameSite: "none", // secure: true, // }); client.setQueryData(["user.me"], { user: res.data.user, errCode: null,app/api/auth/route.ts+9
hooks/useUser.ts+8-7