From the course: Creating .NET MAUI Applications with Blazor

Unlock the full course today

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

Solution: Using the Token

Solution: Using the Token

(upbeat music) - [Instructor] For my solution to this problem, I used the HTTP client just like we did to get the token. Then I set the media type to application/json because that's what we know we'll get back from the Swagger. To send a token, we simply add a new authorization header of type bearer, passing the token and then we call the service URI. If the return is successful, we pull out the content and use Newtonsoft.Json to deserialize it into a user object. Now it's simply a matter of concatenating the first and last name and returning the result. Let's try this out in the browser version of the application. To do this, we want to run the service and the WebAssembly app at the same time. This is something that Visual Studio allows us to do using this solution. So if we go to the solution here and right click and go to properties and make sure that we are on Startup Project, we can select multiple startup projects…

Contents