Giter Site home page Giter Site logo

hemancuso / react-microsoft-login Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexandrtovmach/react-microsoft-login

0.0 1.0 0.0 1.75 MB

Microsoft services authorization with React.

Home Page: https://alexandrtovmach.github.io/react-microsoft-login

License: MIT License

JavaScript 7.44% TypeScript 92.56%

react-microsoft-login's Introduction

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.

buttons

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

Parameter Type Default Description
clientId string required Application (client) ID
authCallback function required Callback function which takes two arguments (error, authData)
graphScopes array ["user.read"] Array of Graph API permission names. More about Graph API permissions.
tenantUrl string "" A URL indicating a directory that MSAL can request tokens from. More about MSAL tenant auth.
redirectUri string window.location.href The redirect URI of the application, this should be same as the value in the application registration portal.
buttonTheme string "light" Name of theme for button style. Themes: "light" "light_short" "dark" "dark_short". Styles come from Official Microsoft brand design.
withUserData boolean false Boolean flag to make an additional request to GraphAPI to get user data.
forceRedirectStrategy boolean false Boolean flag to force redirect login strategy for all browsers. This strategy used by default just for IE browsers to avoid issues.
debug boolean false Boolean flag to enable detailed logs of authorization process.
className string "" Additional class name string.
children ReactComponent null Alternative way to provide custom button element as a children prop instead of Official Microsoft brand design

License

MIT

react-microsoft-login's People

Contributors

alexandrtovmach avatar hemancuso avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.