Install the SDK
The official SDK is @vimine/sdk: TypeScript, ESM, zero dependencies (it uses fetch and
WebCrypto). The browser entry point weighs about 7 kB compressed.
npm install @vimine/sdkpnpm add @vimine/sdkyarn add @vimine/sdkEntry points
Section titled “Entry points”| 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 |
import { Vimine, publicApi, VimineError } from '@vimine/sdk';import { VimineServer } from '@vimine/sdk/server';import { VimineProvider, useVimine, SignInButton } from '@vimine/sdk/react';Requirements
Section titled “Requirements”- Browser:
fetch,crypto.subtle(WebCrypto) andsessionStorage/localStorage— every modern browser. Pages must be served overhttps(orhttp://localhostin development): WebCrypto is not available on insecure origins. - Node: 18 or later (native
fetchandglobalThis.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.
The first sign-in
Section titled “The first sign-in”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());const result = await vimine.handleRedirect(); // exchanges the code, stores the sessionif (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.