Web Development with Blazor - Second Edition by Jimmy Engström
Author:Jimmy Engström
Language: eng
Format: epub
Publisher: Packt
Published: 2023-11-15T00:00:00+00:00
Technical requirements
Make sure you have followed the previous chapters or use the Chapter07 folder as a starting point.
You can find the source code for this chapterâs end result at https://github.com/PacktPublishing/Web-Development-with-Blazor-Second-Edition/tree/main/Chapter08.
Setting up authentication
There are a lot of built-in functionalities when it comes to authentication. The easiest way to add authentication is to select an authentication option when creating a project.
We need to implement authentication separately for the Blazor Server project and the Blazor WebAssembly project because they work differently.
But there are still things we can share between these two projects. First, we need to set up Auth0.
Auth0 is a service that can help us with handling our users. There are many different services like this, but Auth0 is the one that seems to be a very good service to use. We can connect one or many social connectors, which will allow our users to log in with Facebook, Twitter, Twitch, or whatever we add to our site.
Even though all of this can be achieved by writing code ourselves, integration like this is a great way to add authentication fast and also get a very powerful solution. Auth0 is free for up to 7,000 users (which our blog probably wonât reach, especially not the admin interface).
It also has great functionality to add data to our users that we have access to. We will do that later in the chapter when we add roles to our users. Youâll need to take the following steps:
Head over to https://auth0.com and create an account.
Click the Create Application button.
Now itâs time to name our application. Use MyBlog, for example. Then itâs time to select what kind of application type we are using. Is it a native app? Is it a Single-Page Web Application, Regular Web Application, or Machine to Machine Application? This depends on what version of Blazor we are going to run.
But it wonât limit the functionality, only what we need to configure when setting up our application.
We will start with Blazor server, which is a regular web application. But we want to be able to use the same authentication for both Blazor Server and Blazor WebAssembly, and we can do that by selecting Single Page Application.
And if we are only making a Blazor Server Application, we should use Regular Web Application, but since we are doing both, select Single Page Web Application since this will make it possible to run both.
Next, we will choose what technology we are using for our project. We have got Apache, .NET, Django, Go, and many other choices, but we donât have a choice for Blazor specifically, at least not at the time of writing.
Just skip this and click the Setting tab.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
ActiveX | ASP.NET |
Cold Fusion | CSS |
DHTML | Java Server Pages |
JavaScript | PHP |
Python | Ruby |
XSL |
Hello! Python by Anthony Briggs(9914)
The Mikado Method by Ola Ellnestam Daniel Brolund(9777)
Dependency Injection in .NET by Mark Seemann(9337)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7778)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Svelte with Test-Driven Development by Daniel Irvine(7137)
Test-Driven Development with PHP 8 by Rainier Sarabia(6865)
Layered Design for Ruby on Rails Applications by Dementyev Vladimir;(6731)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6532)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6413)
Web Development with Django by Ben Shaw Saurabh Badhwar(6200)
React Application Architecture for Production by Alan Alickovic(5924)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5806)
Kotlin in Action by Dmitry Jemerov(5062)
Audition by Ryu Murakami(4583)
Software Architecture for Web Developers by Mihaela Roxana Ghidersa(4440)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4316)
Accelerating Server-Side Development with Fastify by Manuel Spigolon Maksim Sinik & Matteo Collina(4287)
Functional Programming in JavaScript by Mantyla Dan(4038)
