Go to developer

SDKs / web / oauth

createKeyraAuth()

BROWSERfactory@keyra/web-sdk

Creates the browser OAuth Verify client. Uses publishable clientId and calls POST /oauth/authorize/init internally.

Signature

TypeScript
const keyra = createKeyraAuth({ clientId, redirectUri, domain?: "https://auth.keyra.ie" })

Type signature

TypeScript
function createKeyraAuth(config: KeyraAuthConfig): unknown

Parameters

ParameterTypeRequiredDescription
configKeyraAuthConfigRequired

Returns

unknown

Example

TypeScriptTypeScript
import { createKeyraAuth } from "@keyra/web-sdk";

const keyra = createKeyraAuth({
  clientId: "cp_test_xxxxxxxx",
  redirectUri: "http://localhost:3000/auth/keyra/callback",
  domain: "https://auth.keyra.ie",
});

const result = await keyra.verify({ mode: "popup" });
// Send result.accessToken / result.verificationToken to YOUR backend for validate