Function: createServerConnect()
ts
function createServerConnect(config): ServerConnect;Server-side "Connect with Nosana" session for a confidential app: the sign-in runs on your backend and the code is exchanged with your client secret (no PKCE). Requires a clientSecret.
State and tokens are kept in a store. It defaults to in-memory, which suits a single user; for a multi-user web server pass a store bound to the current user's session so each user's sign-in is isolated.
ts
import { createServerConnect } from '@nosana/connect/server';
const connect = createServerConnect({
clientId: 'stcl_…',
clientSecret: process.env.NOSANA_CLIENT_SECRET,
redirectUri: 'https://yourapp.com/callback',
store: sessionStore, // per-user
});
// /login route: res.redirect(await connect.getLoginUrl());
// /callback route: await connect.handleCallback(req.url);
// then: await connect.getAccessToken();Parameters
| Parameter | Type |
|---|---|
config | ConnectSessionConfig |