gpt4 book ai didi

java - 带有 Microsoft 错误的 Firebase 身份验证

转载 作者:行者123 更新时间:2023-12-04 13:58:49 25 4
gpt4 key购买 nike

我正在尝试在我的 Android 应用上为我的组织实现 Firebase 身份验证。每个员工都有一个 Microsoft 企业帐户,因此我想使用该电子邮件/密码登录我的应用程序。

我在 Firebase 控制台上启用了此选项,并使用我创建的 Azure AD 应用程序的信息填充数据:

enter image description here

Azure AD 应用有权登录用户并阅读他们的个人资料。

enter image description here

我设法让它工作到在我的 Firebase 控制台上创建用户的地步。

enter image description here

但是在我的 Android 应用上,在写入凭据后,会出现此错误消息。

We're having trouble signing you in. AADSTS900561: The endpoint only accepts POST requests. Received a GET request.



enter image description here

Android 代码是 Firebase 提供的示例代码。
OAuthProvider.Builder provider = OAuthProvider.newBuilder("microsoft.com");

Task < AuthResult > pendingResultTask = mAuth.getPendingAuthResult();
if (pendingResultTask != null) {
pendingResultTask.addOnSuccessListener(new OnSuccessListener < AuthResult >
() {
@Override
public void onSuccess(AuthResult authResult) {
Log.e("PROFILE", authResult.getAdditionalUserInfo()
.getProfile().toString());
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.e("FAIL", "ERROR LOGIN");
}
});
} else {
mAuth.startActivityForSignInWithProvider(Login.this, provider.build())
.addOnSuccessListener(new OnSuccessListener < AuthResult > () {
@Override
public void onSuccess(AuthResult authResult) {
Log.e("PROFILE", authResult.getAdditionalUserInfo()
.getProfile().toString());
Log.w("USERNAME", authResult.getUser()
.getDisplayName());

}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.e("FAIL", "ERROR LOGIN: " + e);
}
});
}
PROFILE正在打印日志行,Android Studio 中没有错误。此外,如果用户是在 Firebase 上创建的......我不知道是什么导致登录过程无法完成。

编辑:
这是我在 Azure AD 应用程序上的重定向 URI 配置:

enter image description here

编辑 2:
支持的帐户类型设置为所有帐户。 (这是西类牙语对不起,它说我可以编辑 list 以更改配置)

enter image description here

list 如下所示:
{
"id": "******************************",
"acceptMappedClaims": null,
"accessTokenAcceptedVersion": 2,
"allowPublicClient": null,
"appId": "***************************",
"appRoles": [],
"oauth2AllowUrlPathMatching": false,
"createdDateTime": "2019-04-02T09:53:53Z",
"groupMembershipClaims": null,
"identifierUris": ["api://****************************"],
"informationalUrls": {
"termsOfService": null,
"support": null,
"privacy": null,
"marketing": null
},
"keyCredentials": [],
"knownClientApplications": [],
"logoUrl": null,
"logoutUrl": null,
"name": "App name",
"oauth2AllowIdTokenImplicitFlow": true,
"oauth2AllowImplicitFlow": true,
"oauth2Permissions": [],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [
{
"customKeyIdentifier": null,
"endDate": "2099-12-31T12:00:00Z",
"keyId": "***************************",
"startDate": "2019-04-02T09:55:10.2084897Z",
"value": null,
"createdOn": "2019-04-02T09:55:14.432352Z",
"hint": "gGL",
"displayName": null
}
],
"preAuthorizedApplications": [],
"publisherDomain": "domain.com",
"replyUrlsWithType": [
{
"url": "https://***********.firebaseapp.com/__/auth/handler",
"type": "Web"
},
{
"url": "https://login.live.com/oauth20_desktop.srf",
"type": "InstalledClient"
},
{
"url": "urn:ietf:wg:oauth:2.0:oob",
"type": "InstalledClient"
},
{
"url": "https://login.microsoftonline.com/common/oauth2/nativeclient",
"type": "InstalledClient"
},
{
"url": "msalececeef1-*****************://auth",
"type": "InstalledClient"
}
],
"requiredResourceAccess": [
{
"resourceAppId": "*************************",
"resourceAccess": [
{
"id": "***********************",
"type": "Scope"
}
]
}
],
"samlMetadataUrl": null,
"signInUrl": null,
"signInAudience": "AzureADandPersonalMicrosoftAccount",
"tags": [],
"tokenEncryptionKeyId": null
}

我试过更改 "oauth2RequirePostResponse": falsetrue但它也没有用。

最佳答案

尝试检查管理 -> 身份验证下的 token 复选框?
对我来说,这就是区别

关于java - 带有 Microsoft 错误的 Firebase 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55476704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com