@splitroute/login-client
v0.1.0
Published
SplitRoute client-side OAuth SDK
Maintainers
Readme
@splitroute/login-client
SplitRoute's browser SDK for initiating the authentication flow. It opens the hosted SplitRoute popup, validates the response, and exchanges the authorization code against your backend.
Install
npm install @splitroute/login-clientQuick Start
import { SplitRouteClient } from '@splitroute/login-client';
const client = new SplitRouteClient({
clientId: 'sr_pub_your_client_id',
exchangeUrl: '/api/auth/callback'
});
const session = await client.getSession();
console.log('Logged in user:', session.user);The SDK automatically uses ${authBaseUrl}callback/ for redirect handling and ships with structured SplitRouteAuthError codes so you can provide great UX around failure states.
Documentation
See the workspace README for the full architecture guide and examples.
