good morning. I have a problem with my user registry I am using an action
exports.onExecutePostLogin = async (event, api) => {
if(event.stats.logins_count <= 1){
api.redirect.sendUserTo("http://localhost:5173/Informacion-Adicional")
}else{
api.redirect.sendUserTo
}
};
exports.onContinuePostLogin = async (event, api) => {
};
my code for the state.
I’m just passing the part of the state. that is not all
const searchParams = new URLSearchParams(document.location.search)
const state = searchParams.get('state')
const [ continueUrl ] = useState(`https://dev-elbuensabor.us.auth0.com/continue?state=${state}`)
window.location.href = continueUrl;
The problem is that my user once is already registered. In your first login (the one that comes by default after registering) you cannot perform any action as an authenticated user. In order to perform these actions I must log out and log in again.
When using useAuth0 {isAuthenticated} it seems that if I am authenticated. The problem is when I want to perform one of my fetchs to retrieve the information. that is where the problem arises of having to log out and perform a new login
export default function ListaAlumnos() {
const { getAccessTokenSilently } = useAuth0();
const [alumnos, setAlumnos] = useState([]);
useEffect(() => {
const fetchAlumnos = async () => {
try {
const token = await getAccessTokenSilently({
audience: "localhost:8080/seguridad",
});
console.log("token " + token);
const response = await fetch("http://localhost:8080/alumno", {
headers: {
Authorization: `Bearer ${token}`,
},
});
const data = await response.json();
setAlumnos(data);
} catch (error) {
alert("error");
}
};
fetchAlumnos();
}, [getAccessTokenSilently]);
return (
<div>
<h1>Aquí estará la lista de alumnos</h1>
{alumnos.map((alumno) => (
<div key={alumno.id}>{alumno.nombre}</div>
))}
</div>
);
}
this is my function, when I enter here with my first login, I get the error alert
the problem is getAccessTokenSilently. in my console it appears: Eor: External interaction required