Lynx/Modules/Web Auth/Installation
@sigx/lynx-webauth · Stable

Installation#

Add @sigx/lynx-webauth to your project and register your callback scheme.

Install the package#

Terminal
pnpm add @sigx/lynx-webauth

Native setup#

Native modules are autolinked by @sigx/lynx-cli — run a prebuild after installing. On Android this also adds the androidx.browser (Custom Tabs) dependency:

Terminal
sigx prebuild

Register your callback scheme#

The callbackScheme you pass to openAuthSession is your app's registered custom scheme — the same one Lynx already wires for Linking. Declare it once in signalx.config.ts and run sigx prebuild; the CLI registers it on both platforms (iOS CFBundleURLSchemes, an Android <intent-filter>):

TypeScript
// signalx.config.ts
import { defineLynxConfig } from '@sigx/lynx';

export default defineLynxConfig({
  name: 'My App',
  scheme: 'myapp', // registers myapp:// — used as the OAuth redirect target
});

Point your provider's redirect_uri at myapp://… (any path), and pass the bare scheme — 'myapp' — as the second argument to openAuthSession.

Verify#

TSX
import { isWebAuthAvailable } from '@sigx/lynx-webauth';

console.log(isWebAuthAvailable()); // true once the native module is linked