refresh token arreglado
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//auth.config
|
||||
// lib/auth.config.ts
|
||||
import { SignInAction } from '@/feactures/auth/actions/login-action';
|
||||
import { resfreshTokenAction } from '@/feactures/auth/actions/refresh-token-action';
|
||||
import { CredentialsSignin, NextAuthConfig, Session, User } from 'next-auth';
|
||||
@@ -147,7 +147,10 @@ const authConfig: NextAuthConfig = {
|
||||
// 4. Si el token de acceso ha expirado pero el refresh token es válido, renovar
|
||||
// console.log("Renovando token de acceso...");
|
||||
try {
|
||||
const res = await resfreshTokenAction({ token: token.refresh_token as string, user_id: token.user.id as number});
|
||||
const refresh_token = { token: token.refresh_token as string, user_id: Number(token.id) as number}
|
||||
console.log(refresh_token);
|
||||
|
||||
const res = await resfreshTokenAction(refresh_token);
|
||||
|
||||
if (!res || !res.tokens) {
|
||||
throw new Error('Fallo en la respuesta de la API de refresco.');
|
||||
|
||||
Reference in New Issue
Block a user