Developers
Sign in with Octave
Add Octave sign-in to a web app with the PKCE OAuth client.
Installation
- 01
Install the SDK
Add@octave-ams/auth-sdkto your app.Terminal pnpm add @octave-ams/auth-sdk - 02
Create a client
Use the domain and client ID from your app registration, and the URL Octave should return to after sign-in.auth.ts import { OctaveAuthClient } from "@octave-ams/auth-sdk"; export const auth = new OctaveAuthClient({ domain: "https://YOUR_POOL.auth.us-east-1.amazoncognito.com", clientId: "YOUR_CLIENT_ID", redirectUri: "http://localhost:3000/auth/callback", }); - 03
Send people to sign in
Redirects to the hosted sign-in page with a PKCE challenge.TS await auth.signInRedirect(); - 04
Handle the callback
On your redirect URI, exchange the code for tokens. The state and PKCE verifier are checked for you./auth/callback const tokens = await auth.handleCallback(); // tokens.accessToken, tokens.idToken, tokens.refreshToken - 05
Sign out
Ends the session at Octave and returns to your logout URI.TS auth.signOutRedirect();