跳过内容

Microsoft Entra ID

GitHub

概述

概述

通过以下方式支持 Microsoft Entra ID:

  • 这个 azure Auth Connect 预设
  • 直接 oauth2 配置 Microsoft 身份验证端点

Auth Connect 预设示例

复制到剪贴板
import { SocialLoginAuthConnect } from '@capgo/capacitor-social-login';
await SocialLoginAuthConnect.initialize({
authConnect: {
azure: {
tenantId: 'common',
clientId: 'your-azure-client-id',
redirectUrl: 'myapp://oauth/azure',
},
},
});
const result = await SocialLoginAuthConnect.login({
provider: 'azure',
});

Section titled “Direct OAuth2 example”

Section titled “Auth Connect preset example”
import { SocialLogin } from '@capgo/capacitor-social-login';
await SocialLogin.initialize({
oauth2: {
azure: {
appId: 'your-azure-client-id',
authorizationBaseUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
accessTokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
redirectUrl: 'myapp://oauth/azure',
scope: 'openid profile email User.Read',
pkceEnabled: true,
resourceUrl: 'https://graph.microsoft.com/v1.0/me',
},
},
});
const result = await SocialLogin.login({
provider: 'oauth2',
options: {
providerId: 'azure',
},
});
  • 用你的租户 ID 替换 common 可以指向 Microsoft Graph 以及在登录后立即获取用户资料
  • resourceUrl 相关文档
OAuth2 和 OIDC 提供者

如果您正在使用 Microsoft Entra ID 来规划身份验证和帐户流程,请将其与 使用 @capgo/capacitor-social-login 为在使用 @capgo/capacitor-social-login 中的原生能力 @capgo/capacitor-社交登录 为在 @capgo/capacitor-social-login 中的实现细节 @capgo/capacitor-passkey 为在 @capgo/capacitor-passkey 中的实现细节 @capgo/capacitor-原生生物识别 为在 @capgo/capacitor-native-biometric 中的实现细节 双因素身份验证 双因素身份验证的实现细节。