@tpointurier/ally-microsoft
is a Microsoft driver for AdonisJS Ally.
Getting Started
This package is available in the npm registry.
npm install @tpointurier/ally-microsoft
Next, configure the package by running the followind command.
node ace configure @tpointurier/ally-microsoft
Alternatively, you can use a single command to install and configure the package:
node ace add @tpointurier/ally-microsoft
Then register the service inside the configuration file config/ally.ts
.
import { microsoft } from '@tpointurier/ally-microsoft'
const allyConfig: AllyConfig = {
microsoft: microsoft({
clientId: env.get('MICROSOFT_CLIENT_ID'),
clientSecret: env.get('MICROSOFT_CLIENT_SECRET'),
callbackUrl: env.get('MICROSOFT_CALLBACK_URL'),
scopes: ['openid', 'profile', 'email'],
tenantId: env.get('MICROSOFT_TENANT_ID', 'common'),
}),
}
Available Scopes
Microsoft OAuth2 supports various scopes that you can use to request different levels of access. Here are some commonly used scopes:
openid
: Required for OpenID Connect authenticationprofile
: Access to basic profile informationemail
: Access to email addressoffline_access
: Get a refresh tokenUser.Read
: Read user profileUser.Read.All
: Read all users' basic profilesMail.Read
: Read user's emailCalendars.Read
: Read user's calendarsFiles.Read
: Read user's files
You can add these scopes to the configuration like this:
scopes: ['openid', 'profile', 'email', 'User.Read']
For a complete list of available scopes, please refer to the Microsoft Graph permissions reference.