remix-auth-microsoft
Version:
The Microsoft strategy is used to authenticate users against an account on [Microsoft Active Directory](https://docs.microsoft.com/en-us/azure/active-directory/develop/) using [Remix Auth](https://github.com/sergiodxa/remix-auth). This can be a work/schoo
48 lines (47 loc) • 1.72 kB
TypeScript
import { OAuth2Strategy } from "remix-auth-oauth2";
/**
* @see https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow
*/
export type MicrosoftStrategyPrompt = "login" | "none" | "consent" | "select_account";
/**
* @see https://learn.microsoft.com/en-us/azure/active-directory/develop/scopes-oidc#openid-connect-scopes
*/
export type OpenIDConnectScope = "openid" | "email" | "profile" | "offline_access";
export type MicrosoftStrategyScope = OpenIDConnectScope | (string & {});
export interface MicrosoftStrategyOptions {
clientId: string;
clientSecret: string;
redirectURI: string;
scopes?: MicrosoftStrategyScope[];
tenantId?: string;
prompt?: MicrosoftStrategyPrompt;
}
export interface MicrosoftProfile {
id: string;
displayName: string;
name: {
familyName: string;
givenName: string;
};
emails: [{
value: string;
}];
_json: {
sub: string;
name: string;
family_name: string;
given_name: string;
email: string;
};
}
export declare const MicrosoftStrategyDefaultScopes: OpenIDConnectScope[];
export declare const MicrosoftStrategyDefaultName = "microsoft";
export declare const MicrosoftStrategyScopeSeparator = " ";
export declare class MicrosoftStrategy<User> extends OAuth2Strategy<User> {
name: string;
private readonly prompt?;
private scopes;
constructor({ clientId, clientSecret, redirectURI, scopes, prompt, tenantId, }: MicrosoftStrategyOptions, verify: OAuth2Strategy<User>["verify"]);
protected authorizationParams(params: URLSearchParams): URLSearchParams;
static userProfile(accessToken: string): Promise<MicrosoftProfile>;
}