1.6.2 • Published 4 years ago

react-microsoft-login-ssr-fix v1.6.2

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

react-microsoft-login npm version npm bundle size Libraries.io dependency status for GitHub repo

React component for a simple login with Microsoft services, based on Official Microsoft Authentication Library for JavaScript.

DEMO HERE

🚀 Get started

  1. Install package:
    yarn add react-microsoft-login
  2. Import and configure component:

    import React from "react";
    import MicrosoftLogin from "react-microsoft-login";
    
    export default props => {
      const authHandler = (err, data) => {
        console.log(err, data);
      };
    
      return (
        <MicrosoftLogin clientId={YOUR_CLIENT_ID} authCallback={authHandler} />
      );
    };
  3. YOUR_CLIENT_ID is the key which you need to generate for your Microsoft app. How to create Microsoft app? When finished, on the app Overview page, note down the Application (client) ID value.

API

ParameterTypeDefaultDescription
clientIdstringrequiredApplication (client) ID
authCallbackfunctionrequiredCallback function which takes two arguments (error, authData)
graphScopesarray["user.read"]Array of Graph API permission names. More about Graph API permissions.
tenantUrlstring""A URL indicating a directory that MSAL can request tokens from. More about MSAL tenant auth.
redirectUristringwindow.location.hrefThe redirect URI of the application, this should be same as the value in the application registration portal.
buttonThemestring"light"Name of theme for button style. Themes: "light" "light_short" "dark" "dark_short". Styles come from Official Microsoft brand design.
withUserDatabooleanfalseBoolean flag to make an additional request to GraphAPI to get user data.
forceRedirectStrategybooleanfalseBoolean flag to force redirect login strategy for all browsers. This strategy used by default just for IE browsers to avoid issues.
debugbooleanfalseBoolean flag to enable detailed logs of authorization process.
classNamestring""Additional class name string.
childrenReactComponentnullAlternative way to provide custom button element as a children prop instead of Official Microsoft brand design

License

MIT