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

forgerockembeddedlogin

v0.0.3

Published

Library to assist with login for ForgeRock web clients

Readme

ForgeRock Login Helper

This library provides a simple interface to the login API provided by ForgeRock Access Management. It is designed with few assumptions about the environment that it is running within. It only assumes that it runs within a browser environment; there is no dependency on any JavaScript libraries. It is designed to be easy to work with from whichever front-end technology you normally use for web development (React, Angular, Vue, etc...).

The design of this library is "convention over configuration". The library is functional out-of-the-box with only minimum configuration details. Every aspect of the library is designed to be able to be overridden, if necessary. In theory, you should only have to override very specific functions with your own implementation.

The minimum invocation of this library is demonstrated in sample.html, and you can see the core here:

var login = new ForgeRockEmbeddedLogin({
    authenticateUrl: "https://sample.iam.forgeops.com/am/json/realms/root/authenticate",
    loginElement: document.getElementById("loginPanel"),
    postRenderHandler: function (header, stage, template) {
        document.getElementById("loginHeader").innerHTML = header;
    },
    successHandler: function() {
        document.getElementById("loginHeader").innerHTML = "Logged In!";
        this.loginElement.innerHTML = '';
    },
    failureHandler: function() {
        document.getElementById("loginHeader").innerHTML = "Login Failure!";
        setTimeout(() => this.startLogin(), 2000);
    }
});

login.startLogin();

This code will work with the AM instance specified by the "authenticateUrl" parameter to determine the current state of the user. If they are already logged-in to the AM server, then the "successHandler" will be invoked. If the user needs to log in, then the input fields necessary for the first step of the authentication process will be rendered within the "loginElement" provided. If the user supplies invalid credentials (or if for some other reason AM cannot authenticate the user), the "failureHandler" will be invoked. Each time the login form is rendered, the "postRenderHandler" method will be called (and provided details: the header, stage and template values from the current authentication response).

It is expected that you will want to customize the way in which the input fields are rendered within your application. You have fine-grained control over this rendering. All you have to do is override the appropriate function with your own implementation. For example, if you want to change the way password fields are rendered, you simply have to override the renderPasswordCallback function, like so:

login.renderPasswordCallback = function (callback, index, prompt) {
    let el = document.createElement("div");
    el.innerHTML = `<label>${prompt} : <input type="password" name="callback_${index}" value="${callback.input[0].value}"></label>`;
    return Promise.resolve(el.firstElementChild);
};

As you can see, this function (and most other functions provided by this library) returns a Promise; This is so that it can support any asynchronous logic your rendering might require.