Skip to content

victorp13/react-admin-msal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-Admin integration with MSAL.js 2.0

This example shows one way to integrate Azure Active Directory with React-admin.

Disclaimer: This may not be the perfect implementation but it worked for my personal use case. I am not a Javascript developer so YMMV!

This example uses the MSAL.js 2.0 libraries:

How to run

To run this example you need to set up a SPA application in Azure AD:

AAD registration

Then set up a local .env file that contains the Tenant ID and Client ID of this app:

REACT_APP_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 
REACT_APP_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

OR alternatively replace the corresponding process.env variables in src/authConfig.js

See it working

In this example we call the generic JSONPlaceholder API and are passing the token in dataProvider.js

Although JSONPlaceholder does not require authentication, we can see the bearer token successfully being passed by inspecting the Request Headers via devtools:

devtools inspection

About

Example MSAL.js 2.0 implementation for React-admin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published