Skip to content

qrauth-io/example-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QRAuth Example Integration

A minimal demo showing two QRAuth features in a single page:

  1. Sign in with QRAuth — QR-based passwordless authentication
  2. Verified QR Codes — Cryptographically signed QR codes with tamper-proof verification

Live demo: demo.qrauth.io

Quick Start

git clone https://github.com/qrauth-io/example-integration.git
cd example-integration
npm install

Create a .env file with your QRAuth credentials:

QRAUTH_API_KEY=qrauth_...
QRAUTH_CLIENT_ID=qrauth_app_...
QRAUTH_CLIENT_SECRET=qrauth_secret_...
npm start
# Open http://localhost:3000

How It Works

QR-Based Login (6 lines of frontend code)

<script src="https://qrauth.io/sdk/qrauth-auth.js"></script>
<script>
  new QRAuth({
    clientId: 'qrauth_app_xxx',
    element: '#login',
    onSuccess: (result) => {
      // result.sessionId + result.signature
      // Send to your backend to verify
    },
  });
</script>

The backend verifies the session:

const result = await qrauth.verifyAuthResult(sessionId, signature);
if (result.valid) {
  const { email, name } = result.session.user;
  // Issue your own JWT / session
}

Verified QR Codes (3 lines of backend code)

const qr = await qrauth.create({
  destination: 'https://your-site.com/page',
  expiresIn: '30d',
});
// qr.verification_url → https://qrauth.io/v/xK9m2pQ7
// Scanning shows: org identity, trust score, signature proof

Project Structure

server.js          — Fastify backend (~90 lines)
public/index.html  — Single-page frontend (vanilla JS, no build step)
.env.example       — Required environment variables

No database. No migrations. No build step.

SDKs

  • Node.js: @qrauth/node
  • Python: qrauth
  • Browser: Load from CDN (https://qrauth.io/sdk/qrauth-auth.js)

License

MIT

About

Example integration showing QRAuth QR-based login and verified QR code generation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors