Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use AppAuth-Android with IdentityServer4?

I have successfully configured a Identityserver4 for my ASP.Net MVC client, and everything is working fine. Now I'm looking to develop an Android app client. The MVC client and the Android client uses the same Identity Server for authentication and authorization. So for Android client I'm looking for "AppAuth-Android" GitHub library. But I couldn't find any sample or help to use the library with IdentityServer4. I have read the documentation of the "AppAuth-Android" library and it says

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

So my question is 1) how can I configure my Identity Server to work with Android app.
2) How to authenticate my Android app with the help of "AppAuth-Android".

Any help is greatly appreciated.

Can some one please create a tag for "AppAuth-Android"?

like image 430
Madhu Avatar asked Feb 04 '26 09:02

Madhu


1 Answers

Basiclly, you can use following settings for 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
           }

Anyway you can refer to https://github.com/IdentityServer/IdentityServer4/issues/479 for more details about this issue.

like image 174
V Noah Avatar answered Feb 06 '26 02:02

V Noah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!