4.2.1 • Published 2 months ago

@microsoft/mgt-msal2-provider v4.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Microsoft Graph Toolkit MSAL 2.0 Provider

npm

The Microsoft Graph Toolkit (mgt) library is a collection of authentication providers and UI components powered by Microsoft Graph.

The @microsoft/mgt-msal2-provider package exposes the Msal2Provider class which uses msal-browser to sign in users and acquire tokens to use with Microsoft Graph.

Usage

  1. Install the packages

    npm install @microsoft/mgt-element @microsoft/mgt-msal2-provider
  2. Initialize the provider in code

    import {Providers, LoginType} from '@microsoft/mgt-element';
    import {Msal2Provider, PromptType} from '@microsoft/mgt-msal2-provider';
    
    // initialize the auth provider globally
    Providers.globalProvider = new Msal2Provider({
      clientId: 'clientId',
      isMultiAccountDisabled?: Boolean, //Set this to true to disable multi account functionality
      scopes?: string[],
      authority?: string,
      redirectUri?: string,
      loginType?: LoginType, // LoginType.Popup or LoginType.Redirect (redirect is default)
      prompt?: PromptType, // PromptType.CONSENT, PromptType.LOGIN or PromptType.SELECT_ACCOUNT
      sid?: string, // Session ID
      loginHint?: string,
      domainHint?: string,
      options?: Configuration // msal js Configuration object
    });
  3. Alternatively, initialize the provider in html (only client-id is required):

    <script type="module" src="../node_modules/@microsoft/mgt-msal2-provider/dist/es6/index.js" />
    
    <mgt-msal2-provider client-id="<YOUR_CLIENT_ID>"
                      login-type="redirect/popup" 
                      scopes="user.read,people.read" 
                      redirect-uri="https://my.redirect/uri" 
                      multi-account-disabled
                      authority=""> 
    </mgt-msal2-provider> 

    The multi-account-disabled attribute if present disables multi account functionality.

See provider usage documentation to learn about how to use the providers with the mgt components, to sign in/sign out, get access tokens, call Microsoft Graph, and more.

Sea also

4.2.1

2 months ago

4.2.0

2 months ago

4.1.0

3 months ago

4.0.1

3 months ago

4.0.0

4 months ago

3.1.3

7 months ago

3.1.2

9 months ago

3.1.1

9 months ago

3.1.0

10 months ago

3.0.1

10 months ago

2.11.2

11 months ago

3.0.0

11 months ago

2.11.0

12 months ago

2.11.1

12 months ago

3.0.0-preview.2

1 year ago

2.10.1

1 year ago

3.0.0-rc.2

12 months ago

3.0.0-rc.1

12 months ago

3.0.0-rc.3

12 months ago

3.0.0-preview.1

1 year ago

2.10.0

1 year ago

2.9.2

1 year ago

2.9.1

1 year ago

2.9.0

1 year ago

2.8.0

1 year ago

2.7.0

2 years ago

2.7.1

2 years ago

2.6.2

2 years ago

2.6.1

2 years ago

2.6.0

2 years ago

2.5.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.4.0

2 years ago

2.3.2

2 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago