Skip to content

m-moris/azure-ad-javascript-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample of OAuth2 implicit grant flow in Azure Active Directory

Japanese

This sample is created for the purpose of self-study. This client (JavaScript) authenticates to Azure AD and gets an access token(JWT). This sample uses jwt-decode to decode JWT. This library does not support validation for JWT.

I think that it's much better to use ADAL.js.

Preparation

{
    "oauth2AllowImplicitFlow": true,
}
  • Rename config.sample.js to config.js and , embed tenant and client-id.
    {
        client_id : "<<client-id>>",
        authorization_endpoint:"https://login.microsoftonline.com/<<tenant>>/oauth2/authorize",
        end_session_endpoint:"https://login.microsoftonline.com/<<tenant>>/oauth2/logout",
        redirect_uri : "http://localhost:8080/",
    }

Run

Start the http-server. Alternatively, you may use any different HTTP server, but be careful with the response URL.

> npm install http-server
> .\node_modules\.bin\http-server.cmd
  1. Click Login button and redirect authentication page.
  2. Input your credential. When authenticated, redirect to reply URL and clients get token.
  3. Invoke Graph API with token from client.
  4. Some information will be displayed.

Reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published