Skip to main content

Pre-requisites

Before installing this package, make sure to follow below steps:
1

Request repository access to the Packages

Reach out to IAM team to request access to the Packages repository:
2

Generate a personal access token

Generate a personal access token with the following scopes:
repo
read:packages
3

Create an .npmrc file

Create an .npmrc file and add below code:
@locai1:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_PERSONAL_ACCESS_TOKEN

Install

Download the package using your preferred package manager:
pnpm install @locai1/iam-react

Set your environment variables

To configure your application, you’ll need to set the following environment variables in your .env.local file. These variables are essential for connecting to the IAM service and defining your application settings.
NEXT_PUBLIC_IAM_BASE_URL=https://dev-iam.razi.ai
NEXT_PUBLIC_IAM_APP_NAME=locai

Add IAM provider to your React app

Integrate the IAM provider into your React application by wrapping your components with the IamProvider. This allows you to leverage IAM functionalities. Import the styles and provide configuration from environment variables.
layout.tsx
import { IamProvider } from "@locai1/iam-react";

import "@locai1/iam-react/styles.css";

const IAM_BASE_URL = process.env.NEXT_PUBLIC_IAM_BASE_URL;
const IAM_APP_NAME = process.env.NEXT_PUBLIC_IAM_APP_NAME;

  export default function RootLayout({
    children,
  }: Readonly<{
    children: ReactNode;
  }>) {
    return (
      <IamProvider
        iamBaseUrl={IAM_BASE_URL}
        iamAppName={IAM_APP_NAME}
      >
        {children}
      </IamProvider>
    );
}
🎉 Now your setup is complete, explore the various IAM functionalities available to enhance your application’s capabilities. If you encounter any issues or have questions, don’t hesitate to reach out to the Platform support team.