Authentication Provider for delegated access on graph-interface package.
Important: This version have breaking changes and is not compatible with the previous major version of this module or graph-interface.
Note: This documentation consider that you already know how to use the graph-interface package.
You can get this package on NPM
CommonJS:
const GraphInterfaceDesktopProvider = require('graph-interface-desktop-provider');
ES Modules:
import GraphInterfaceDesktopProvider from 'graph-interface-desktop-provider';
The imported GraphInterfaceDesktopProvider
function is used in the authenticationProvider
option of the GraphInterface
initializer function:
const graph = GraphInterface(credentials, {
authenticationProvider: GraphInterfaceDesktopProvider(providerOptions),
...options
})
The providerOptions
object allows the following properties:
interface ProviderOptions {
interactionMode: InteractionMode;
accountType: AccountType;
serverPort: number;
vaultName: string;
}
type InteractionMode = 'browser' | 'cli';
type AccountType = 'personal' | 'corporate' | 'both';
-
interactionMode - The way that the package will request for an authentication.
browser
will open the default web browser with the authentication URL, whilecli
will print in thestdout
the authentication URL. Defaultbrowser
; -
accountType - The type of account that your application accept. It changes the authority of the authentication process.
corporate
uses thecredentials.tenantId
authority,personal
usesconsumers
andboth
usescommon
. Depending on the scope of your application, an accordingaccountType
should be chosen. Defaultboth
; -
serverPort - The port that the web server will listen on to get the authorization code and complete the authentication. Default
9090
; -
vaultName - The service name of the keytar package. It is a system-wide name, so it is highly recommended to set this property to avoid credential collision between services. Default
GraphInterface::DesktopProvider::Vault
.