title: Blazor Client Side authentication jwt or cookies
body: <p>So i am experimenting with client side blazor and trying to figure correct implementation for JWT or Cookie authentication.
  Suppose that i have a service that serves the tokens and refresh token on client side i will have multiple API Services that will need to use this token or cookies to create API requests.</p>
  
  <p>So as i understand i will need to implement and API Service classes similarly as documented here <a href="https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests</a></p>
  
  <p>So in order to have a consistent authentication state an Authentication service should be introduced and injected to the API Service classes. This service will have the responsibility of doing auth,getting initial token and doing a refresh token when required.</p>
  
  <p>So with the latest release of Blazor there is this new component called AuthenticationStateProvider, the use of it seem to be clear but the question is would it be correct approach to use this as a global Authentication service?</p>