I'm trying to get access token and id token from auth0 login
The useUser hook only returning the user info, while I want to get access token and social media id of user which I want to send to my own custom php api to get user data and validate on my own database,
Kindly help me on this problem and suggest some good approaches according to you
here's my login page code:
import React from "react";
import { useUser} from "@auth0/nextjs-auth0";
const login = () => {
const { user, isLoading, error } = useUser();
//all user data here, with tokens
console.log(user);
return (
<div>
<div className="contentContainer">
<div className="contentRight">
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
flexDirection: "column",
height: "100vh",
width: "100vw",
}}
>
{user ? (
<div style={{ display: "flex", flexDirection: "column" }}>
<a href="/api/auth/logout">Sign Out</a>{" "}
<img src={user.picture} alt="" />
<h1>{user.name}</h1>
</div>
) : (
<a href="/api/auth/login">Sign in</a>
)}
</div>
</div>
</div>
</div>
);
};
export default login;