I want make a Single Sign On, where when I access my dashboard.sunize.com.br if there isn't a access_token
, I will be redirected to sso.sunize.com.br and I will be authenticated and save my access and refresh in the cookies from sso.sunize.com.br, so I will be redirected to dashboard.sunize.com.br and I will ask to sso.sunize.com.br API for get the cookies with the access token, but the saved tokens do not come. This is my sso.sunize.com.br API route:
import { cookies } from "next/headers";
export async function GET(req: Request) {
const Cookies = cookies();
console.log("all cookies:", Cookies.getAll());
return Response.json({ tokens: Cookies.getAll() });
}
export async function POST(request: Request) {
const res = await request.json();
cookies().set("at", res.at);
return Response.json({ at: res.at });
}
I need that the token that I saved in sso.sunize.com.br become when I make a request from dashboard.sunize.com.br for this token.