mirror of
https://github.com/logto-io/logto.git
synced 2024-12-23 20:33:16 -05:00
900 B
900 B
title | subtitle |
---|---|
Initiate LogtoClient | 1 step | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
Add the following code to your main html file. You may need client ID and authorization domain.
import { LogtoProvider, LogtoConfig } from '@logto/react';
import React from 'react';
...
const App = () => {
const config: LogtoConfig = { clientId: 'foo', endpoint: 'https://your-endpoint-domain.com' }
return (
<BrowserRouter>
<LogtoProvider config={config}>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/callback" element={<Callback />} />
<Route
path="/protected-resource"
element={
<RequireAuth>
<ProtectedResource />
</RequireAuth>
}
/>
</Routes>
</LogtoProvider>
</BrowserRouter>
);
};