Search code examples
identityserver4

trigger IdentityServer4 login flow when AutomaticChallenge is false


I'm trying to learn IdentityServer4 from http://identityserver4.readthedocs.io/en/release/quickstarts/6_aspnet_identity.html

It works fine. Client app can login when I use AutomaticChallenge = true on OpenIdConnectOptions.

Since my app is an angularjs SPA, I'm actually planning for the angular app to go to a certain url say: localhost/doIdentityServer4login whenever I get 401.

But I can't find a way to trigger oidc login when I set AutomaticChallenge to false.


Solution

  • After days of searching and trying, finally found it, in case anyone need it: https://github.com/IdentityServer/IdentityServer4.Samples/blob/release/Clients/src/MvcManual/Controllers/HomeController.cs

    This should teach me not to only rtfm, but rtfs.. Read the f samples...