android - 如何将 AppAuth-Android 与 IdentityServer4 一起使用?

标签 android identityserver4

我已经为我的 ASP.Net MVC 客户端成功配置了一个 Identityserver4,并且一切正常。 现在我正在寻找开发一个 Android 应用程序客户端。 MVC 客户端和Android 客户端使用相同的Identity Server 进行身份验证和授权。 所以对于 Android 客户端,我正在寻找 "AppAuth-Android" GitHub 库。但是我找不到任何示例或帮助将库与 IdentityServer4 一起使用。我已经阅读了“AppAuth-Android”库的文档,上面写着

In general, AppAuth can work with any Authorization Server (AS) that supports native apps.

所以我的问题是 1) 如何配置我的身份服务器以使用 Android 应用程序。
2) 如何在“AppAuth-Android”的帮助下验证我的 Android 应用程序。

非常感谢任何帮助。

有人可以为“AppAuth-Android”创建一个标签吗?

最佳答案

基本上,您可以对 identityserver4 使用以下设置

new Client
           {
               ClientId = "client.android",
               RequireClientSecret = false,
               ClientName = "Android app client",
               AllowedGrantTypes = GrantTypes.Code,
               RequirePkce = true,
               RequireConsent = false,

               RedirectUris = { "net.openid.appauthdemo://oauth2redirect" },
               AllowedScopes =
               {
                   IdentityServerConstants.StandardScopes.OpenId,
                   IdentityServerConstants.StandardScopes.Profile,
                   IdentityServerConstants.StandardScopes.Email,
                   IdentityServerConstants.StandardScopes.Phone,
                   "api1"
               },
               AllowOfflineAccess = true
           }

反正可以引用https://github.com/IdentityServer/IdentityServer4/issues/479有关此问题的更多详细信息。

关于android - 如何将 AppAuth-Android 与 IdentityServer4 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40604144/

相关文章:

android - 如何在 Android Studio 中查看已编译的 Jar 文件以进行顶层模拟?

android - 防止服务被杀死

java - 无法让我的应用程序运行。只是崩溃

c# - 如何在 IdentityServer4 中向访问 token 添加自定义声明?

android - 避免图像被缩略图服务处理

c# - Identity Server 4 - 未经授权的客户端

azure-active-directory - IdentityServer4、Swift iOS App 和外部身份提供者

ionic-framework - 身份服务器 + ionic + OpenID 混合流

c# - 无效的 redirect_uri IdentityServer4 和 AppAuth

java - 通过不同的方法更改和使用变量