如何将Android应用程序集成到Identity Server和ASP.NET Core 3.1进行身份验证



我已经使用visual studio创建了带有Angular Template身份验证的ASP.NET Core项目。现在我正在开发Android应用程序,并希望将其与我现有的ASP.NET CORE 3.1 WEB API(后端(集成。我在appsettings.json中为我的android应用程序添加了客户端,如下所示:

"IdentityServer": {
"Clients": {
"MyAngularApp": {
"Profile": "IdentityServerSPA"
},
"MyMobileApp": {
"Profile": "NativeApp"
}
}
}

当我调用我的配置端点";https://localhost:4042/_configuration/MyMobileApp",我得到了以下回应;

{"authority":"https://localhost:4042","client_id":"MyMobileApp","redirect_uri":"urn:ietf:wg:oauth:2.0:oob","post_logout_redirect_uri":"urn:ietf:wg:oauth:2.0:oob","response_type":"code","scope":"offline_access MyAppAPI openid profile"}

我有以下问题;

  • 什么是";urn:ietf:wg:oauth:2.0:oob"意思是在redirect_uri中?

  • 当我在这样的客户端设置中添加redirect_uri时,

    "MyMobileApp":{"配置文件":"NativeApp","RedirectUri":"com.example.myapplication"}

    但是当我调用端点时,我没有得到我定义的redirect_uri"https://localhost:4042/_configuration/MyMobileApp",作为回应,我得到了这个"redirect_uri":"urn:ietf:wg:oauth:2.0:oob"。那么,如何更改默认的RedirectUri?

我正在使用Android中的AppAuth库与Identity Server集成。

在appsetting.json中,尝试您必须使用Identity Server-客户端尝试这可能是您的问题将被解决

"IdentityServer": {
"IssuerUri": "urn:sso.company.com",
"Clients": [
{
"Enabled": true,
"ClientId": "local-dev",
"ClientName": "Local Development",
"ClientSecrets": [ { "Value": "<Insert Sha256 hash of the secret encoded as Base64 string>" } ],
"AllowedGrantTypes": [ "implicit" ],
"AllowedScopes": [ "openid", "profile" ],
"RedirectUris": [ "https://localhost:5001/signin-oidc" ],
"RequireConsent": false
}
]
}

最新更新