🛡️Gatekeeper/ SDKs

Server-side OAuth handshake. authorize returns the provider URL to redirect to; callback exchanges the redirect for tokens. Both public. The redirect URI is derived server-side, never client-supplied.

import { GatekeeperCore, OAuthService } from '@orkait/sdk';
 
const oauth = new OAuthService(core);

Methods#

MethodReturnsNotes
authorize(provider)OAuthAuthorization{ url, state }; redirect the user to url
callback(provider, params)AuthTokensparams: { state, code?, error?, errorDescription? }

provider: google \| github \| microsoft \| discord (whichever the server has configured).

Example#

const { url, state } = await oauth.authorize('google'); // redirect user to url, persist state
// on return:
const tokens = await oauth.callback('google', { state, code });
core.setToken(tokens.accessToken);