// This import is only included in the server build, because it's only used by getServerSideProps import auth0 from "../../lib/auth0"; import Layout from "../../components/layout"; function Profile({ user }) { return (

Profile

Profile (server rendered)

user picture

nickname: {user.nickname}

name: {user.name}

); } export async function getServerSideProps({ req, res }) { // Here you can check authentication status directly before rendering the page, // however the page would be a serverless function, which is more expensive and // slower than a static page with client side authentication const session = await auth0.getSession(req, res); if (!session || !session.user) { res.writeHead(302, { Location: "/api/v1/login", }); res.end(); return; } return { props: { user: session.user } }; } export default Profile;