npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

janrain-login-client-sdk

v0.1.4

Published

A login client for Janrain currently only supporting Register Native

Downloads

6

Readme

Janrain Login Client SDK

An SDK to interface with Janrain's Authorization API providing reasonable defaults.

Configuration

const Janrain =  require('janrain-login-client-sdk');

const defaults = {
  client_id: '1234567890',
  flow: 'standard',
  flow_version: '1234567890',
  locale: 'en-US',
  redirect_uri: 'http://localhost:3000',
}

const config = {
  url: 'https://YOUR_APP_NAME.janraincapture.com',
  defaults,
};

const options = {
  timeout: 5000,
};

const client = new Janrain(config, options);

Usage

async function register(firstName, lastName, email, password) {
  const attrs = {
    firstName,
    lastName,
  };

  return await client.register(email, password, attrs);
}

Note: Any specified attributes (attrs) will override any default configuration.

Example

Let's assume defaults for your login client were configured like the following:

const defaults = {
  client_id: '1234567890',
  flow: 'standard',
  flow_version: '1234567890',
  locale: 'en-US',
  redirect_uri: 'https://domain.com',
}

If for some reason you wanted to change the redirect uri you could do this:

async function register(firstName, lastName, email, password, redirectUri) {
  const attrs = {
    firstName,
    lastName,
    redirect_uri: redirectUri, // updates previously configured redirect uri
  }

  return await client.register(email, password, attrs);
}

API

The provided functions return Axios' default HTTP response. This allows for flexibility in handling errors how you please. You can see an example below.

Register

Creates new user entity in Janrain

client.register(emailAddress, password, attrs = {})

Login

Get access token for existing entity. Redirect URI must match previously provided value. If you're configuring it to a default value, you can ignore this.

client.login(emailAddress, password, redirectUri = "")

Update Profile

Updates user profile associated with access token

client.updateProfile(attrs, token)

Is something not working? See something that isn't yet supported?

Please open an issue in Github or submit a pull request :)

Example

This code sample is used to work around Janrain rate limiting.

const promiseRetry = require('promise-retry');

const client = new Janrain(config, options);

const register = (user) => {
  const { firstName, lastName, email, password, phone } = user;

  return new Promise((resolve, reject) => {
    client.register(email, password, { firstName, lastName, phone }).then((resp) => {
      const { stat: status, error } = resp.data;

      if (status === 'error' && error === 'invalid_form_fields') {
        // For our use case let's assume this error an attempt to create
        // an account that exists. Do not reject here.
        console.log(`Account with email ${ email } already exists.`);
      } else if (status === 'error') {
        // Reject and retry.
        reject(`Error: ${resp.data.error} Reason: ${resp.data.error_description}`);
      }

      resolve();
    }).catch((e) => {
      reject(e);
    });
  });
};

module.exports.registerWithRetry = (user) => {
  return promiseRetry(function (retry, number) {
    console.log(`Attempt: ${ number }`)
    return register(user).catch((err) => {
      console.log(err);
      retry();
    });
  }, { retries: 100, minTimeout: 60000 });
}