Blazor Server Side Authenticatoin

Hello, Looking for some guidance on using okta with a Blazor server side application. I’m hoping the procedure is much like a basic asp.net core applicatoin, https://developer.okta.com/quickstart/#/okta-sign-in-page/dotnet/aspnetcore. What else would i need to setup?

thanks,
~ Paul

Update, I’m able to get it to work using the configuration from this articular.

The Okta.AspNetCore nuget package does’t work with .net core 3.0. So, the above artical is how to configure long hand.

Also, one trick to get the first page to redirect to a okta login page is to add the following …

services.AddRazorPages(o => o.Conventions.AuthorizeFolder("/"));

@pwelter34
I am also trying to set up a Blazor Server Side App with Okta.

I was wonder if you the above method is still your recommendation.

I tried to work though this demo: https://developer.okta.com/blog/2019/10/16/csharp-blazor-authentication But got no where with it.

I tried the post that you recommended but again, not getting far. Would you have a code example of what you did to set this up? Any help would be appreciated.

To set up Blazor (Server Side) and okta, see these 2 posts:


Note: Both post must be reviewed.

Greetings,

I’ve followed the articles above, but when i click log out nothing appears to have changed. If put a breakpoint after await HttpContext.SignOutAsync() in the LogoutModel I can see User.Identity.IsAuthenticated == true. No error appears to be thrown by the SignOutAsync method.

Any suggestions?

Do you have “/oauth2/default” at the end of your okta Issuer?

yes, my solution pretty much matches the article exactly

Also, if i look at the logs for the app in the Okta dashboard, i only see sign 0n events, no sign outs.

If the code is the same, then my only suggestion is to take a close look at ALL of your Okta General Settings. The values I used are in the first screen shot in the StackOverflow post. They are also shown in the original otka developer post.

Maybe cut and paste them from the okta developer post just be sure.

Since you are having problems with Logging Out, here is what I used for the Logout redirect:

https://localhost:5001/signout-callback-oidc

But, I would review them all.

Yes, mine is the same. Any chance you could provide source for a working example?

I will try to set up something this week. (Sorry I have a lot going on back here.)

Thank you, much appreciated!

Don’t mean to hassle you - just a gentle reminder. I have tried re-doing the entire solution and am still getting the same problem with logging out…i must be missing something simple somewhere.

The blog post has been updated with more complete code samples:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.