Skip to content

Install the SDK

View as Markdown

The official SDK is @vimine/sdk: TypeScript, ESM, zero dependencies (it uses fetch and WebCrypto). The browser entry point weighs about 7 kB compressed.

Finestra del terminale
npm install @vimine/sdk
Import What it contains Where
@vimine/sdk Vimine (Sign in with Vimine + member API), publicApi, VimineError, the types browser; Node too with a storage of your own
@vimine/sdk/react VimineProvider, useVimine, SignInButton React ≥ 18 (optional peer dependency)
@vimine/sdk/server VimineServer (confidential clients, client_credentials, sandbox) Node ≥ 18 — never in a browser
browser
import { Vimine, publicApi, VimineError } from '@vimine/sdk';
server
import { VimineServer } from '@vimine/sdk/server';
React
import { VimineProvider, useVimine, SignInButton } from '@vimine/sdk/react';
  • Browser: fetch, crypto.subtle (WebCrypto) and sessionStorage/localStorage — every modern browser. Pages must be served over https (or http://localhost in development): WebCrypto is not available on insecure origins.
  • Node: 18 or later (native fetch and globalThis.crypto).
  • Bundler: any (Vite, webpack, esbuild, …) or <script type="module"> with a bundle of your own. The package is ESM only.
  • TypeScript: types are included; no @types/* to add.
app.js
import { Vimine } from '@vimine/sdk';
const vimine = new Vimine({
clientId: 'vmc_…', // from the Developers console
redirectUri: 'https://www.example.org/vimine/callback', // registered for the client
scopes: ['profile:read', 'membership:read']
});
document.querySelector('#sign-in').addEventListener('click', () => vimine.signIn());
callback.js
const result = await vimine.handleRedirect(); // exchanges the code, stores the session
if (result) {
const me = await vimine.me.get();
console.log(`Hello ${me.first_name}`);
}

Continue with Sign in with Vimine for the whole flow, the session and signing out.