What is Blazor? A Tutorial on Building Web Apps with Authentication

Hey @MickCG,
Welcome to the Auth0 Community!
I’m glad to hear that the Blazor WASM sample project worked well.

I’m not familiar with Amazon Amplify, but I can try to help you anyway. Can you tell me specifically what the problem is? Are you getting an error? What error message?

Mostly in Amazon I have to put a Login URI and a Logout URI I think that is where my trouble is because I think on the verify its giving a 401 error. I do with the provided URI to test it on the web get to the index page but then the Login seems to go south. I am spending some time looking at their Amazon examples of blazor, seem to me I found one.

After I wrote my last post I went back into the app and realized I don’t think I’m actually getting to the logon screen from Auth0. Seems to me it should be the same info for that as the local version which woks???

Not sure about the problems you are experiencing. I would suggest checking the following:

  • Make sure that you are using the actual AWS Amplify base URL for the callback and logout URLs in the Auth0 dashboard. I mean, when you run your app locally, you use https://localhost:7290 as the base URL (for example, https://localhost:7290/callback). When you run your app in AWS Amplify, you need to register something like https://xxxxxxxxxxxxxx.amplifyapp.com/callback.

  • Since your Blazor WASM app is a SPA, make sure that all the URL requests are redirected to the app. As I said, I’m not familiar with AWS Amplify, but I found that you should create a redirect, specifically a redirect for SPA.

Let me know if these tips are helpful.

That got me a lot further. But when I hit the login button I get the following error:
image
and it sits completing login needless to say.

Honestly, I’m not sure I can help you. I have little context for the problem and no experience with AWS Amplify.
If everything works well locally, I think this is a specific deployment platform problem. At first glance, it could be a missing redirect to the SPA. In this case, it is not a Blazor problem and even less an Auth0 problem. It’s a general SPA hosting problem that you can solve by configuring redirection properly. But I can only make assumptions

Thanks for your response, I sort of was leaning that way too, good to see a confirmation from someone with more experience, thanks again!

1 Like

@Ditchford and anyone else interested in, I wrote a blog post about the logout problem in Blazor Server

Hello @andrea.chiarelli I followed the code but not sure why the app is being redirected to Account/Login. It is getting the redirect error below.

No web page was found for the web address: https://localhost:7231/Account/Login?ReturnUrl=%2F

Hi @mela,
Welcome to the Auth0 Community!

From the error you shared, it seems that your application is not configured properly.
Account/Login is the default login path used by ASP.NET Core Identity. Are you using the Auth0 ASP.NET Core Authentication SDK as suggested in the article?
Have you tried the sample project attached to the article and compared its code with your code?
Alternatively, please share your code.

this sample code is working using my app auth0 credentials. Still trying to figure out how to translate this code to Net 8 Blazor.

Wait @mela, the article and its sample project are for .NET 7.0.
.NET 8 changes the Blazor hosting model. You can move seamlessly from Server to WASM at the component level. So, the approach used in this article may not work.
Currently, there are no official guidelines on how to deal with external OIDC providers (I’m still exploring this).
See this thread on this topic.

I had some issues with Blazor 8, which I’ve worked around after reviewing the GitHub repo. Recap is here: Updated How-To for Blazor 8? Auth0 article on covers Blazor 6 - Auth0 Community

1 Like

This article is for .NET 6 and 7. With .NET 8 many things have changed in the Blazor application model. Please, refer to the following articles for Blazor in .NET 8: