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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gazelle-auth-lib

v0.0.2

Published

Gazelle Authentication Library

Downloads

51

Readme

Gazelle authentication library

Gazelle Auth lib is a library of reusable authentication components for React applications. This library aims to provide a set of well-designed and accessible components to speed up the development process and ensure consistency across the Gazelle application.

This library is intended to be used with Next.js application.

Installation

You can install the gazelle-auth-lib package via npm or yarn:

npm install gazelle-auth-lib
# or
yarn add gazelle-auth-lib

Usage

To use the components from gazelle-auth-lib in your React application, import the desired component and use it like any other React component.

example of command to add the library to your package.json :

npm install gazelle-auth-lib --save

Configuration

Once the library is added, you need to add the following files to your applications :

# HTTP API (used by client component to retrieve some data)
/app/api/auth/[...nextauth]/route.ts
/app/api/auth/[...nextauth]/authOption.ts
/app/api/getOrganization/[organizationId]/route.ts
/app/api/getUserById/route.ts
/app/api/getUserPicture/route.ts

# next-auth configuration
/middleware.ts
/next-auth.d.ts

You also need to add the following dependency to your pom.xml

"next-auth": "^4.24.10",

Environment variables

To work with your application properly at runtime, you must provide the following environment variable when you start your application :

| Variable | Description | Required | Example | |----------------------|---------------------------------|----------|---------------------------------------------| | NEXT_PUBLIC_BASE_URL | The base url of the application | YES | http://localhost:3000/home | | GZL_GUM_API_URL | The api url if the GUM api | YES | https://localhost:8080/gum/rest | | GZL_GUM_UI_URL | The api url if the GUM api | YES | https://localhost:8080/gum-ui | | NEXTAUTH_URL | The next-auth api url | YES | http://localhost:3000/home/api/auth/ | | NEXTAUTH_SECRET | The next-auth keycloak secret | YES | secret | | KEYCLOAK_ISSUER | The keycloak issuer | YES | http:///localhost:28080/auth/realms/gazelle | | KEYCLOAK_CLIENT_ID | The keycloak client ID | YES | OIDC_GAZELLE_CLIENT |

Publish the library

In order to use this library in all other Next-JS projects, we need to publish the components on a registry.

As image registry, we are using https://www.npmjs.com.

Prerequisites

  • Check that you are authenticated to the registry (npm whoami), if not, use the command npm adduser.

  • Check the version in your package.json. You can't push a library on an existing version.

Usage

You can publish the new version to the registry with the command :

npm publish

Once the library is pushed, you can go to your Next-JS application to change the library version in the package.json. Execute the npm install command. You can now use the components you developped.