Skip to content

Releases: marmelab/ra-auth-msal

3.0.0

12 Sep 13:09
Compare
Choose a tag to compare
  • Upgrade @azure/msal-browser to v3

Breaking Changes

In MSAL v3.x, you must initialize the application object by calling the initialize function asynchronously.

One way to achieve this is by using the useEffect hook in your main component:

// in src/App.jsx
-import React from 'react';
+import React, { useEffect } from "react";
import { Admin, Resource } from 'react-admin';
import { BrowserRouter } from "react-router-dom";
import { PublicClientApplication } from "@azure/msal-browser";
import { LoginPage, msalAuthProvider } from "ra-auth-msal";
import dataProvider from './dataProvider';
import posts from './posts';
import { msalConfig } from "./authConfig";

const myMSALObj = new PublicClientApplication(msalConfig);

const App = () => {
+ const [isMSALInitialized, setMSALInitialized] = React.useState(false);
+ useEffect(() => {
+   myMSALObj.initialize().then(() => {
+     setMSALInitialized(true);
+   });
+ }, []);

  const authProvider = msalAuthProvider({
    msalInstance: myMSALObj,
  });

+ if (!isMSALInitialized) {
+   return <div>Loading...</div>;
+ }

  return (
    <BrowserRouter>
       <Admin
           authProvider={authProvider}
           dataProvider={dataProvider}
           title="Example Admin"
           loginPage={LoginPage}
        >
            <Resource name="posts" {...posts} />
      </Admin>
    </BrowserRouter>
   );
};
export default App;

See the MSAL upgrade guide for more information.

2.0.0

30 Aug 14:27
Compare
Choose a tag to compare
  • Upgrade react-admin to v5
  • Remove prop-types

1.2.0

27 Nov 08:43
v1.2.0
c83d68c
Compare
Choose a tag to compare

1.1.0

21 Jul 14:58
v1.1.0
Compare
Choose a tag to compare
  • Add support for automatic token refresh (#7) (djhi)
  • Suppress error message when redirecting to login after unsuccessful auth (#6) (MarkSFrancis)
  • [Doc] Improve msalHttpClient documentation (#3) (slax57)

1.0.0

01 Mar 08:25
4f31baa
Compare
Choose a tag to compare

Initial release