Link to the account pages
Send a person to the hosted pages for their profile, security settings, sessions, agents and connected accounts.
What it shows
- The header of the app has the user button. Its menu item Manage account opens the hosted page Personal info.
- The settings page of the app links to seven hosted pages: the profile, the security settings, the devices, the authorized apps, the agents, the connected accounts and the privacy settings.
- The person changes a detail on a hosted page. LumoAuth checks the password or the second factor where a change needs it.
- The app shows the new name after its next page load.
Your app builds none of these pages, and it stores no password and no MFA secret.
Before you start
- An application for a browser app, with its client ID. A new organization has the Starter App, which accepts
http://localhost:5173. For an application of your own, follow the steps of Sign in through the hosted page. - A test user to sign in with.
| Variable | Value |
|---|---|
LUMOAUTH_URL | The address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region. |
LUMOAUTH_ORG_ID | Your organization, for example acme-corp. |
LUMOAUTH_CLIENT_ID | The client ID of the application. A browser app has no client secret. |
Code
Run each command from the recipes folder of the examples repository. Set the folder up once for your language. Every version below was run against a LumoAuth organization. The recipe is a small project with its own package.json. A real browser signed in, opened each link and the menu of the user button, and changed the name on the hosted page.
- React
accounts/account-pages/js/src/App.jsx
// A header with the user button, and a settings list that links to the
// hosted account pages. Your app builds none of these pages.
import { SignedIn, SignedOut, SignInButton, UserButton, useAuth, useUser } from '@lumoauth/react';
// The account pages are not below /orgs/{organization}: the session at
// LumoAuth says which account to show.
const accountPages = [
['/account/profile', 'Personal info', 'Name, email address, language and time zone'],
['/account/security', 'Sign-in & security', 'Password, passkeys, two-step verification and recovery codes'],
['/account/sessions', 'Your devices', 'Where the account is signed in, with a sign-out button for each device'],
['/account/consents', 'Authorized apps', 'The apps that may use the account'],
['/account/my-agents', 'AI agents acting for you', 'The agents that hold access for the person'],
['/account/connections', 'Accounts agents can use', 'The outside accounts that agents may use'],
['/account/privacy', 'Privacy & data', 'Data download, consent history and account deletion'],
];
export default function App() {
return (
<main>
<header style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<strong>Acme</strong>
{/* The menu of the user button has "Manage account", which opens
/account/profile, and "Sign out". */}
<UserButton showName afterSignOutUrl="/" />
</header>
<SignedOut>
<p>Nobody is signed in.</p>
<SignInButton />
</SignedOut>
<SignedIn>
<Settings />
</SignedIn>
</main>
);
}
function Settings() {
const user = useUser();
// config.domain is the LumoAuth host, or the custom domain of the
// organization when the provider has one.
const { config } = useAuth();
return (
<>
<h1>Settings</h1>
<p>Signed in as {user?.displayName}</p>
<ul>
{accountPages.map(([path, title, text]) => (
<li key={path}>
{/* A new tab keeps your app open: the account pages have no link back. */}
<a href={config.domain + path} target="_blank" rel="noreferrer">
{title}
</a>
: {text}
</li>
))}
</ul>
</>
);
}
accounts/account-pages/js/src/main.jsx
// Link from your app to the hosted account pages of LumoAuth, with React.
//
// cd accounts/account-pages/js && npm install && npm run dev
//
// Then open http://localhost:5173.
import { createRoot } from 'react-dom/client';
import { AuthCallback, LumoAuthProvider } from '@lumoauth/react';
import App from './App.jsx';
const callbackPath = '/auth/callback';
createRoot(document.getElementById('root')).render(
<LumoAuthProvider
domain={import.meta.env.LUMOAUTH_URL}
orgId={import.meta.env.LUMOAUTH_ORG_ID}
clientId={import.meta.env.LUMOAUTH_CLIENT_ID}
redirectUri={window.location.origin + callbackPath}
>
{window.location.pathname === callbackPath ? <AuthCallback afterSignInUrl="/" /> : <App />}
</LumoAuthProvider>,
);
accounts/account-pages/js/vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// The browser gets these three values and nothing else from the environment.
// None of them is a secret: a browser app has no client secret and no API key.
export default defineConfig({
plugins: [react()],
define: {
'import.meta.env.LUMOAUTH_URL': JSON.stringify(process.env.LUMOAUTH_URL ?? 'https://app.lumoauth.dev'),
'import.meta.env.LUMOAUTH_ORG_ID': JSON.stringify(process.env.LUMOAUTH_ORG_ID ?? ''),
'import.meta.env.LUMOAUTH_CLIENT_ID': JSON.stringify(process.env.LUMOAUTH_CLIENT_ID ?? ''),
},
});
cd accounts/account-pages/js && npm install && npm run dev
Open http://localhost:5173.
Check the result
Click Sign in. After sign-in the app shows these lines, each with a link:
Output
Signed in as Maya Chen
Personal info: Name, email address, language and time zone
Sign-in & security: Password, passkeys, two-step verification and recovery codes
Your devices: Where the account is signed in, with a sign-out button for each device
Authorized apps: The apps that may use the account
AI agents acting for you: The agents that hold access for the person
Accounts agents can use: The outside accounts that agents may use
Privacy & data: Data download, consent history and account deletion
- Click each link. The hosted page opens in a new tab, and it asks for no second sign-in: the browser has a session at LumoAuth from the sign-in of the app.
- Click the avatar in the header, then Manage account. The browser opens
/account/profile. - Change Full name on Personal info, and click Save changes. Reload your app: the header and the line "Signed in as" show the new name.
- On Your devices, the row This device is the session that your app started.
Limits
- The account pages are not below
/orgs/{organization}. The session at LumoAuth selects the account, so a link is the same for every person. - When the session at LumoAuth has ended, a link shows the sign-in page first.
- A link takes no return address, and the hosted pages do not send the person back to your app. Open them in a new tab, as the recipe does.
- The hosted pages have their own layout. To show account details in the layout of your app, see A profile page in your app.
- With a custom domain, set
customDomainon the provider. The links of the recipe then use that domain.