From the course: Creating .NET MAUI Applications with Blazor

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Implementing authentication with Auth0: Part 3

Implementing authentication with Auth0: Part 3 - .NET MAUI Tutorial

From the course: Creating .NET MAUI Applications with Blazor

Implementing authentication with Auth0: Part 3

- [Instructor] We now have a login service that allows the user to log in and maintains the token that can be used to authenticate future calls. But how do we know if they are logged in? A simple answer may be to look at if we have a token or not, but it can be more complex. The token can be expired. In that case, they will need to log in again. They also could be offline, and in that case, they won't be able to call any authentication service, and instead, we'll need to look at if they've logged in within the last three days. To start, we'll create a private method to return their login state. And we also want this to be an asynchronous method. So we'll go private async, and we'll have it return a Task of type Boolean. It's going to be true if they have a valid credentials, and false if they don't. So we'll have has valid creden as the name of the method, and let's create a return value that's a Boolean, and we'll just…

Contents