
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@corbit/microsoft-sso-react
Advanced tools
This package provides a suite of React components designed to integrate Microsoft Identity Platform authentication into your React applications using the Microsoft Authentication Library (MSAL). It simplifies the setup and usage of MSAL to manage user aut
This package provides a suite of React components designed to integrate Microsoft Identity Platform authentication into your React applications using the Microsoft Authentication Library (MSAL). It simplifies the setup and usage of MSAL to manage user authentication and session management in a scalable way.
This packages works great together with @corbit/microsoft-sso-node!
To install the package, run the following command in your project directory:
npm
npm install @corbit/microsoft-sso-react
yarn
yarn add @corbit/microsoft-sso-react
The package includes the following components:
A provider component that initializes the MSAL instance with custom configurations and wraps the entire part of an application that requires MSAL context.
Prop | Type | Required | Default | Description |
---|---|---|---|---|
clientId | string | Yes | - | Your application's client ID in Azure AD. |
tenantId | string | Yes | - | Your Azure AD tenant ID. |
redirectUri | string | No | /auth-callback | Redirect URI after authentication. |
postLogoutRedirectUri | string | No | /home | URI to navigate after logout. |
cacheLocation | string | No | sessionStorage | Browser storage to cache tokens. |
storeAuthStateInCookie | boolean | No | false | Whether to store the auth state in cookies. |
children | ReactNode | Yes | - | React components that require MSAL context. |
This component wraps any child components that require user authentication. It uses MSAL to handle authentication redirects and ensures that the user is logged in before rendering the children.
Prop | Type | Required | Default | Description |
---|---|---|---|---|
handleLogin | function | Yes | - | Function to execute after a successful login. |
loginRoute | string | No | /login | Redirect URI for login. |
errorRoute | string | No | / | Redirect URI for errors. |
children | ReactNode | Yes | - | Child components to render upon successful authentication. |
A button component that triggers the MSAL login process when clicked. It displays a styled button that can be customized to match dark or light themes.
Prop | Type | Required | Default | Description |
---|---|---|---|---|
darkMode | boolean | No | true | Indicating whether to use dark mode styling. |
This should be in the file where your routes are located. Probably this will be App.jsx
import { BrowserRouter, Routes, Route, Outlet } from "react-router-dom";
import { RoutesWrapper } from "@corbit/microsoft-sso-react";
import Login from "./pages/Login";
import AuthCallback from "./pages/AuthCallback";
import Home from "./pages/Home";
function PrivateRoute() {
// Custom authentication logic
const isAuth = true;
if (!isAuth) return <Navigate to="/login" />;
return <Outlet />;
}
function PublicRoute() {
return <Outlet />;
}
function App() {
//Best to store them in an .env file
//These are required
const tenantId = ""
const clientId = ""
return (
<BrowserRouter>
<RoutesWrapper clientId={clientId} tenantId={tenantId}>
<Routes>
<Route element={<PublicRoute />}>
<Route path="/login" element={<Login />} />
<Route path="/auth-callback" element={<AuthCallback />} />
</Route>
<Route element={<PrivateRoute />}>
<Route path="/home" element={<Home />} />
</Route>
</Routes>
</RoutesWrapper>
</BrowserRouter>
);
}
export default App;
AuthCallback Page
import React from "react";
import { AuthCallbackWrapper } from "@corbit/microsoft-sso-react";
export default function AuthCallback() {
const handleLogin = async (token) => {
try {
const response = await axios.post(`/auth/microsoft_login`, {
token,
});
//Handle response
} catch (error) {
//Handle error
}
};
//handleLogin prop is required
return (
<AuthCallbackWrapper handleLogin={handleLogin}>
<div>AuthCallback</div>
</AuthCallbackWrapper>
);
}
Login Page
import { LoginButton } from '@corbit/microsoft-sso-react'
export default function Login() {
return (
<div>
<LoginButton />
</div>
)
}
FAQs
This package provides a suite of React components designed to integrate Microsoft Identity Platform authentication into your React applications using the Microsoft Authentication Library (MSAL). It simplifies the setup and usage of MSAL to manage user aut
The npm package @corbit/microsoft-sso-react receives a total of 0 weekly downloads. As such, @corbit/microsoft-sso-react popularity was classified as not popular.
We found that @corbit/microsoft-sso-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.