Push sign-in with number matching
Sign in by approving a request in the LumoAuth app. The person picks the number that the sign-in page shows.
What it shows
- A signed-in person follows the link of the app to Sign-in & security, the account page of LumoAuth. There they add the LumoAuth app and scan its QR code.
- LumoAuth sends a test notification. The person taps the number that the page shows, and the phone becomes a sign-in method.
- At the next sign-in, after the password, the hosted page sends a push and shows a two-digit number. The LumoAuth app shows three numbers.
- The person taps the matching number and confirms with a fingerprint, a face or the passcode. The browser returns to your app.
- The same phone also confirms sensitive actions (step-up), and it can sign the person in with the email address alone.
The app has no push code. The hosted pages send the push, show the number and wait for the answer.
Before you start
- A public application with a redirect URI, and the origin of your app in its Allowed origins. The Starter App of a new organization accepts
http://localhost:5173. Sign in through the hosted page has the steps for an application of your own. - The LumoAuth app on a phone, from the App Store or Google Play.
pushamong the factors of the MFA policy, as it is by default. The setup script of MFA and step-up prints the policy.
| 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. The recipe is a small project with its own package.json. A browser signed in with a password, opened the account page from the link and reached the QR code and the activation code of the LumoAuth app.
- React
// The app: sign in through the hosted page, and a link that adds the LumoAuth app.
import { SignedIn, SignedOut, SignOutButton, useAuth, useUser } from '@lumoauth/react';
export default function App() {
const user = useUser();
const { signInWithRedirect, config } = useAuth();
return (
<main>
<h1>Push sign-in</h1>
<SignedOut>
{/* The hosted page sends the push and shows the number. The app has no push code. */}
<button type="button" onClick={() => signInWithRedirect()}>Sign in</button>
</SignedOut>
<SignedIn>
<p>{user ? `Signed in as ${user.email}` : 'Loading the profile…'}</p>
{/* The phone is added on the account page of LumoAuth, which shows the QR code. */}
<p>
Approve sign-ins on your phone:{' '}
<a href={`${config.domain}/account/security`} target="_blank" rel="noreferrer">add the LumoAuth app</a>
</p>
<SignOutButton />
</SignedIn>
</main>
);
}
// Sign in with a push to the LumoAuth app on the hosted page, and add the app from your app.
//
// cd sign-in/push/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>,
);
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 sign-in/push/js && npm install && npm run dev
Compiles. Not run against an organization. The app ran against an organization up to the page with the QR code. No phone with the LumoAuth app was used, so no push was approved.
Check the result
Open http://localhost:5173, click Sign in and sign in with the password. The app shows these lines:
Signed in as maya.chen@example.com
Approve sign-ins on your phone: add the LumoAuth app
- Click add the LumoAuth app. On Sign-in & security, click Add a sign-in method, choose LumoAuth app, then Continue.
- Scan the QR code with the LumoAuth app, or type the activation code under it. Tap the number of the test notification.
- Sign out, and sign in again. After the password, tap the number that the page shows.
- Tap a wrong number. The sign-in is refused, and the attempt counts as a denial.
lumo users authenticators list maya.chen@example.comlists the phone as a push factor, at tier 2.
Limits
- A push expires after 60 seconds. Resend sends a new push with a new number, and Use a code from the app instead accepts the code that the app shows offline.
- A person gets three pushes in five minutes. After two denials in ten minutes, push is paused for that person for 30 minutes.
- The QR code and the activation code work once and expire after 10 minutes. A person can have five phones.
- Only the LumoAuth app approves a push. Your own mobile app cannot.