DevelopersSign in with UseOneID

Sign in with UseOneID

Allow users to sign up and log into your app with 1 tap. Every login automatically returns verified identity claims (Name, Email, Verified NIN, Phone, and Avatar Photo) without manual form typing.

Button Customization

Preview the clean, Google-style button design.

Button Preview

How the "Zero-Form" Sign Up & Login Works

Scenario A: User Already Has UseOneID

1. User clicks "Continue with UseOneID" on your platform.
2. Confirms with a quick biometric or security PIN in 3 seconds.
3. Your app receives verified details (Name, Email, Verified NIN, Phone, Avatar) without them typing a single form.
4. Their account is created and automatically marked Identity Verified on Day 1.

Scenario B: First-Time User

1. User clicks "Continue with UseOneID" on your app.
2. Completes a 1-minute quick identity verification.
3. Redirected back to your app with full verified credentials.
4. Next time they visit any app in your network, they log in with 1 tap.

Code Examples & Integration

Frontend: React / Next.js Component
import { UseOneIDButton } from "@useoneid/react";

export function LoginPage() {
  const handleSuccess = async ({ token, user }: { token: string; user: any }) => {
    console.log("Verified User Profile:", user);
    // Send signed RS256 token to your backend session
    await fetch("/api/auth/useoneid", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ token }),
    });
  };

  return (
    <div className="login-card">
      {/* 1-Tap UseOneID Sign In Button (Google-Style) */}
      <UseOneIDButton
        clientId="client_live_your_partner_id"
        redirectUri="https://yourapp.com/auth/callback"
        onSuccess={handleSuccess}
        text="Continue with UseOneID"
        theme="light"
      />
    </div>
  );
};
Frontend: Vanilla HTML / Link Embed
<!-- Embeddable HTML Button (Clean Google-Style) -->
<a href="https://auth.useoneid.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=https%3A%2F%2Fyourapp.com%2Fauth%2Fcallback&response_type=code&scope=openid+profile+email+kyc%3Averified"
   style="display:flex;align-items:center;justify-content:center;gap:10px;background:#ffffff;color:#262626;border:1px solid #e5e5e5;padding:12px 16px;border-radius:12px;text-decoration:none;font-family:sans-serif;font-weight:700;font-size:13px;box-shadow:0 1px 2px rgba(0,0,0,0.05);">
  <img src="https://cdn.useoneid.com/assets/favicon.ico" width="20" height="20" alt="UseOneID" />
  <span>Continue with UseOneID</span>
</a>
Backend: OAuth Exchange & User Blend (Node.js)
// Backend: Exchange Code & Blend User Profile (Node.js / Express)
app.get('/auth/callback', async (req, res) => {
  const { code } = req.query;

  // 1. Exchange authorization code for tokens
  const tokenRes = await fetch('https://api.useoneid.com/v1/oauth/token', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      client_id: process.env.USEONEID_CLIENT_ID,
      client_secret: process.env.USEONEID_CLIENT_SECRET,
      code,
      grant_type: 'authorization_code',
      redirect_uri: 'https://yourapp.com/auth/callback'
    })
  });
  const { access_token } = await tokenRes.json();

  // 2. Fetch verified identity profile & avatar picture
  const userRes = await fetch('https://api.useoneid.com/v1/oauth/userinfo', {
    headers: { 'Authorization': `Bearer ${access_token}` }
  });
  const oneIdUser = await userRes.json();
  /*
    oneIdUser = {
      sub: "usr_9a48f2c1",
      email: "tenant@example.com",
      given_name: "Precious",
      family_name: "Chinonso",
      phone_number: "+2348012345678",
      picture: "https://cdn.useoneid.com/avatars/usr_9a48f2c1.jpg",
      identity_verified: true,
      kyc_tier: "Tier 2",
      nin_hash: "a8f9c1...83d"
    }
  */

  // 3. Auto-blend into your database (Zero Form Fill!)
  const user = await db.users.upsert({
    where: { email: oneIdUser.email },
    create: {
      email: oneIdUser.email,
      name: `${oneIdUser.given_name} ${oneIdUser.family_name}`,
      phone: oneIdUser.phone_number,
      avatarUrl: oneIdUser.picture,
      useoneidSub: oneIdUser.sub,
      isVerified: oneIdUser.identity_verified, // Auto-verified on day 1!
    },
    update: {
      useoneidSub: oneIdUser.sub,
      avatarUrl: oneIdUser.picture,
      isVerified: oneIdUser.identity_verified,
    }
  });

  // 4. Issue your app session
  req.session.userId = user.id;
  res.redirect('/dashboard');
});
Backend: Permission Revocation Webhook
// Webhook Handler: Handle User Disconnect / Permission Revocation
app.post('/api/v1/webhooks/useoneid', async (req, res) => {
  const { event, data } = req.body;

  // When a user revokes access inside their UseOneID consumer app
  if (event === 'identity.consent_revoked') {
    await db.users.update({
      where: { useoneidSub: data.user_sub },
      data: { isSsoConnected: false }
    });
  }

  res.status(200).json({ received: true });
});