目标。 使用MS Identity应用程序,该应用程序是由美国政府创建的。微软 并尽量根据我们的需求来定制应用。
问题 安卓应用程序没有将签名哈希与应用程序的回复URI相匹配。
Signature Hash: ga0RGNYHvNM5d0SLGQfpQWAPGJ8=
Redirect URI: msauth://com.azuresamples.msalandroidapp/ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3D
Android:host: com.azuresamples.msalandroidapp
Android Scheme: msauth
日志显示。配置文件中的重定向URI与包名和签名哈希生成的URI不匹配。Android模拟器中的错误截图
试图通过将android:path值改为 /ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3D
然而,从用户界面上得到了这样的消息。更新android:path值的截图
试图直接从Azure Portal中更改回复URI,但无法更改。
尝试将android代码中的重定向URI改为 msauth://com.azuresamples.msalandroidapp/ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3D
但也出现了同样的错误
代码中的默认库是1.2,在gradle中改成了1.5+,但还是不行。
auth_config_single_account.json。
"client_id" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"authorization_user_agent" : "DEFAULT",
"redirect_uri" : "msauth://com.azuresamples.msalandroidapp/ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3D",
"account_mode" : "SINGLE",
"broker_redirect_uri_registered": true,
"authorities" : [
{
"type": "AAD",
"authority_url": "https://login.microsoftonline.com/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
]
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.azuresamples.msalandroidapp">
...
<intent-filter>
...
<data
android:host="com.azuresamples.msalandroidapp"
android:path="/ga0RGNYHvNM5d0SLGQfpQWAPGJ8="
android:scheme="msauth" />
</intent-filter>
...
</manifest>
Build-Gradle:app
...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:$rootProject.ext.appCompatVersion"
implementation "com.google.android.material:material:$rootProject.ext.materialVersion"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.volley:volley:1.1.1'
if (findProject(':msal') != null) {
// For developer team only.
localImplementation project(':msal')
externalImplementation 'com.microsoft.identity.client:msal:1.5.+'
}
else {
// Downloads and Builds MSAL from maven central.
implementation 'com.microsoft.identity.client:msal:1.5.+'
}
}
本来想避免这个问题,但是我已经用microsoft提供的debug.keystore更新了我的keystore,并且成功了,但是这不是生产环境的解决方案。我需要采取什么步骤才能在生产环境中工作。
我是MSAL Android团队的Dome。
如果你想使用你自己的keystore,你将不得不 注册自己的申请.
com.azuresamples.msalandroidapp只用提供的debug.keystore的签名哈希注册。
如果你有任何其他问题,请告诉我。您也可以 在我们的GitHub仓库中留下问题 也是(我们一直在监测这个问题)。