title | description | services | documentationcenter | author | manager | editor | ms.service | ms.devlang | ms.topic | ms.tgt_pltfrm | ms.workload | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
include file |
include file |
active-directory |
dev-center-name |
navyasric |
mtillman |
active-directory |
na |
include |
na |
identity |
09/17/2018 |
nacanuma |
include file |
This guide demonstrates how a JavaScript single-page application (SPA) can sign in personal, work and school accounts, get an access token, and call the Microsoft Graph API or other APIs that require access tokens from the Azure Active Directory v2.0 endpoint.
The sample application created by this guide enables a JavaScript SPA to query the Microsoft Graph API or a Web API that accepts tokens from Azure Active Directory v2.0 endpoint. For this scenario, after a user signs in, an access token is requested and added to HTTP requests through the authorization header. Token acquisition and renewal are handled by the Microsoft Authentication Library (MSAL).
This guide uses the following library:
Library | Description |
---|---|
msal.js | Microsoft Authentication Library for JavaScript Preview |
Note
msal.js targets the Azure Active Directory v2.0 endpoint - which enables personal, school and work accounts to sign in and acquire tokens. The Azure Active Directory v2.0 endpoint has some limitations. To understand differences between the v1.0 and v2.0 endpoints read the Endpoint comparison guide.