damien113 Posted April 19, 2020 Share Posted April 19, 2020 I am having a really hard time getting OpenIDConnect to work properly with this asp.net 4.6 mvc 5 project. Recently I was getting a 404 error and ended up adding a custom route to the callback action to get it to work past that. AFter that I started getting a error about GetExternalLoginInfoAsync() returning null and getting a nullreferenceexception. This is what my config looks like with some things redacted, along with the routing. Also the image provided is one of the errors I get,if i dont use custom routing i just get a 404 error. If anyone has a sample project connecting to WHMCS with OpenID Connect in C# with Owin, let me know. OpenIdConnect nonce cookie is there, along with session ID, also in the URL it is sending the state and the code which is below. https://localhost:44348/signin-oidc/?code=e33dab0ae5e9640ef731c460180780092703727b&state=OpenIdConnect.AuthenticationProperties%3D-JlLC-VdZi-KZst8OY4JikRrl59vm19HATAcOaqUv8a22U8ch9gC_IJARHlsvaDKZQrqfeTewtdk5d-KcZSrUR3qCoJVcmzNRDP8C0JJ2NH9ql42J3H1xkxEzoAvJ0wxITy-tCj5H-N-bYhMZbO4kB8s2S4msCF0kEDzgipoPmGfZfreUeyYcerwK_OJGH3uYKUYa1NjqA0G-hlhiYpUj8DUp59EXpDz6sr1wtohTiI Code var json = ""; using (WebClient wc = new WebClient()) { json = wc.DownloadString("http://orders.data443.com/oauth/openid-configuration.php"); } var settings = new OpenIdConnectAuthenticationOptions { Authority = "https://orders.data443.com/oauth/", ClientId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", RedirectUri = "https://localhost:44348/signin-oidc/", CallbackPath = new PathString("/signin-oidc/"), Configuration = new OpenIdConnectConfiguration(json), ResponseType = OpenIdConnectResponseType.Code, SignInAsAuthenticationType = "Cookies", TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = false, }, Scope = "openid email profile" }; app.UseOpenIdConnectAuthentication(settings); Routing routes.MapRoute( name: "signin-oidc", url: "signin-oidc", defaults: new { controller = "Account", action = "ExternalLoginCallback" }); [1]: https://i.stack.imgur.com/ZT4aT.png 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.