import React, { useContext } from 'react' import StyledText from '../Styled/StyledText' import CodeBox from '../Styled/CodeBox' import { AuthContext } from '../AuthProvider' import Layout from '../Layout/Layout' import StyledCard from '../Styled/StyledCard' const Home = () => { const { session, sessionToken } = useContext(AuthContext) if (!session) { return null } // Get the name, or if it does not exist in the traits, use the // identity's ID const { name: { first = String(session.identity.id) } = {} } = session .identity.traits as any return ( Welcome back, {first}! Hello, nice to have you! You signed up with this data: {JSON.stringify(session.identity.traits || '{}', null, 2)} You are signed in using an ORY Kratos Session Token: {sessionToken} This app makes REST requests to ORY Kratos' Public API to validate and decode the ORY Kratos Session payload: {JSON.stringify(session || '{}', null, 2)} ) } export default Home