Node.js Enterprise SDK

The official Node.js library for high-performance rNet OAuth authentication and AI execution.

NPM@rnet-ai/rnet-oauth-node

Installation

bash
npm install @rnet-ai/rnet-oauth-node

1. Initialize Clients

javascript
import { RNetOAuthClient, ModelClient } from '@rnet-ai/rnet-oauth-node';

const auth = new RNetOAuthClient({
  clientId: process.env.RNET_CLIENT_ID,
  clientSecret: process.env.RNET_CLIENT_SECRET,
  redirectUri: 'https://api.yourdomain.com/callback'
});

const gemini = new ModelClient('gemini-2.5-flash-lite');

2. Generate Cryptographic Challenge (PKCE)

javascript
const { verifier, challenge } = auth.generatePKCE();
const authUrl = auth.getAuthorizationUrl(challenge, 'secure-random-state');

3. Exchange Code for Tokens

javascript
const tokens = await auth.exchangeCodeForToken(code, verifier);
const accessToken = tokens.access_token;

4. Invoke AI Pipelines

javascript
const response = await gemini.chat({
  contents: [
    { role: 'user', parts: [{ text: 'Optimize this algorithm.' }] }
  ]
}, accessToken);

console.log(response);