1

I have created ASP.NET Core project with Angular Template with authentication using visual studio. Now I am developing Android App and want to integrate it with my existing ASP.NET CORE 3.1 WEB API (Backend). I have added client in appsettings.json for my android app as follow:

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

When I call my configuration endpoint "https://localhost:4042/_configuration/MyMobileApp", I got the following response;

{"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"}

I have the following Question;

  • what does "urn:ietf:wg:oauth:2.0:oob" means in the redirect_uri?

  • When I added redirect_uri in client settings like this,

    "MyMobileApp": {"Profile": "NativeApp","RedirectUri": "com.example.myapplication"}

    but I didn't get my defined redirect_uri when I call the endpoint "https://localhost:4042/_configuration/MyMobileApp", In response I got this "redirect_uri":"urn:ietf:wg:oauth:2.0:oob". So, how can I change the default RedirectUri?

I am using AppAuth library in Android for integrating with Identity Server.

1 Answers1

0

In appsetting.json try you have to IdentityServer - Clients try this may be your issue will be resolve

"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
    }
  ]
}

V J
  • 1
  • When using this client configuration, I got compile time error " System.InvalidOperationException: 'Type '' is not supported.' This exception was originally thrown at this call stack: Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureClients.GetClients() Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureClients.Configure(Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationOptions) Microsoft.Extensions.Options.OptionsFactory.Create(string) ... ". – Omair Akram Oct 12 '20 at 10:13