import { LogtoProvider, useLogto } from '@logto/react'; import { demoAppApplicationId } from '@logto/schemas/lib/seeds'; import React, { useEffect } from 'react'; import '@/scss/normalized.scss'; import * as styles from './App.module.scss'; import Callback from './Callback'; import congrats from './assets/congrats.svg'; const Main = () => { const { isAuthenticated, signIn } = useLogto(); const isInCallback = Boolean(new URL(window.location.href).searchParams.get('code')); // Pending SDK fix const username = 'foo'; const userId = 'bar'; useEffect(() => { if (!isAuthenticated && !isInCallback) { void signIn(window.location.href); } }, [isAuthenticated, isInCallback, signIn]); if (isInCallback) { return ; } if (!isAuthenticated) { return null; } return (
Congrats
You've successfully signed in the demo app!
Here is your personal information:

Username: {username}

User ID: {userId}

{/* Pending SDK fix */}
Sign out the demo app
or continue to explore
); }; const App = () => { return (
); }; export default App;