Kurve
It looks like this:
const id = new kurve.Identity("your-client-id", "http://your/path/to/login.html");
id.loginAsync().then(_ => {
const graph = new kurve.Graph(id);
graph.me.messages.GetMessages().then(messages => {
console.log("my emails:");
messages.value.forEach(message =>
console.log(message.subject)
)
});
graph.me.manager.GetUser().then(manager => {
console.log("my manager", manager.displayName);
console.log("their directs:");
manager._context.directReports.GetUsers().then(directs =>
directs.value.forEach(direct =>
console.log(direct.displayName)
)
)
});
});
Kurve works well with most JavaScript and TypeScript frameworks including Angular 1, Angular 2, Ember, and React.
Kuve enables developers building web applications - including single application pages - to support a range of authentication and authorization scenarios including:
kurve.js is a UMD file, allowing maximum flexibility.
Note: node support is currently highly experimental.
Install kurve from npm:
npm install kurvejs
Include kurve.js into your project:
import kurve = require ("kurvejs"); // typescript
var kurve = require("kurvejs"); // javascript
Install kurve from npm:
npm install kurvejs
Copy login.html to your source tree.
Include kurve.js into your project:
import kurve = require ("kurvejs"); // typescript
var kurve = require("kurvejs"); // javascript
Bundle kurve into your app using webpack, browserify, etc.
Include kurve.js into your html:
<script src="https://github.com/MicrosoftDX/kurvejs/raw/master/kurve.js"/>
Copy login.html to your source tree.
If using TypeScript, add the following:
/// <reference path="kurve-global.d.ts"/>
const kurve = window["Kurve"] as typeof Kurve;
Note that Kurve (capitalized) is the namespace that declares the types, where kurve (lowercase) is the module. Use Kurve when declaring types, and kurve for everything else:
const error:Kurve.Error = new kurve.Error()
npm install
npm run build
The first thing you have to decide before using Kurve is which app model version you will use:
App model V1 is the current, production supported model in Azure AD. This model implies that:
App model V2 is a new, more modern way which is still in Preview and has limitations at this point. It enables more flexible scenarios, including AAD B2C which leverages external identity providers such as Facebook and user signup/signin/profile edit support. This model implies that:
As mentioned above, B2C enables users to sign up to your AAD tenant using external identity providers such as Facebook, Google, LinkedIn, Amazon and Microsoft Acount. You define policies and the attributes you want to collect during the sign up, for example a user might have to enter their name, e-mail and phone number so that gets recorded into your tenant and accessible to your application.
Important notes in this step:
Different than with the app model v2, there's no authorization flow here. You can request for access tokens to specific resources. What this model will let you do is sign up and sign in users to your app with their identities from other identity providers. That's it.
Make sure you have enabled the implicit flow as you register the application under Azure AD B2C. You will need implicit flow for this framework to work.
Make sure the redirect URL points to where the login page will be. Below you will see as part of the guidance that you need to copy the sample login.html to your website, so if it points to something like https://localhost:8000/login.html, this will be exactly what the reply URL will also have to be.
You can use Kurve Graph without Kurve Identity by passing an access token directly:
const graph = new kurve.Graph("access_token");
Or else link it to a Kurve.Identity object:
const graph = new kurve.Graph(idKurve);
For information on accessing the graph, see the QueryBuilder documentation.
To run samples, start an http server using port 8000 in the root directory of this repository and aim your browser at http://localhost:port/samples.html
No it is not. This is an experimental unofficial open source project. If you are looking for a supported APIs we encourage you to call Microsoft's Graph REST APIs directly.
You are free to take the code, change and use it any way you want it. But please be advised this code isn't supported.
You are free to send us your feedback at this Github repo, send pull requests, etc. But please don't expect this to work as an official support channel
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.