Search code examples
c#asp.net-coreasp.net-core-mvcidentityserver4vue-cli-3

Exception: Correlation failed. Unknown location


After identityserver authentication when it redirects to my application, it gives

Exception: Correlation failed. Unknown location

Now because I am using SPA. This route is definitely not there. But question is how do I define one. And what should I do there.

I have used hybrid flow of Identityserver.

https://localhost:44375/signin-oidc

I have referred following.

https://github.com/IdentityServer/IdentityServer4.Samples/blob/master/Clients/src/MvcHybridAutomaticRefresh/Startup.cs

But in above link there is a SPA middleware. which is VueCliMiddleWare. (And to me that is creating issue. routes.)

(For Rest of the routes it returns index file as per following code. Only this /oidc-client path is not working.)

     app.Use(async (context, next) =>
        {
            await next();
            if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
            {
                context.Request.Path = "/index.html";
                await next();
            }
        })
.UseDefaultFiles(new DefaultFilesOptions { DefaultFileNames = new List<string> { "index.html" } });

If I define following

routes.MapSpaFallbackRoute(
                    name: "spa - fallback",
                    defaults: new { controller = "CatchAll", action = "Index" });

Then this route redirects to that controller. But there I am not able to return index file.


Solution

  • It was mentioned as per below link that state property was missing.

    But still I am not able to figure out how do I set one.

    So not marking as accepted answer if someone has final answer.

    https://github.com/aspnet/AspNetCore/issues/7501#issuecomment-464082989

    Updated:

    Below is the answer to this.

    https://stackoverflow.com/a/54721271/9263418