Blazor & WASM in combination to get statistics from Spotify API for performing the song analysis. With separate microservices for auth, Spotify, user data tracking, and application, connected through gRPC with Polly.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

AuthProvider.cs 794B

1234567891011121314151617181920212223242526
  1. using Blazored.SessionStorage;
  2. using System.Security.Claims;
  3. namespace NemAnBlazor
  4. {
  5. public class AuthProvider : AuthenticationStateProvider
  6. {
  7. private readonly ISessionStorageService _sessionStorage;
  8. public AuthProvider(ISessionStorageService sessionStorage)
  9. {
  10. _sessionStorage = sessionStorage;
  11. }
  12. public override async Task<AuthenticationState> GetAuthenticationStateAsync()
  13. {
  14. string token = await _sessionStorage.GetItemAsync<string>("token");
  15. ClaimsIdentity identity = new ();
  16. ClaimsPrincipal user = new (identity);
  17. AuthenticationState state = new(user);
  18. NotifyAuthenticationStateChanged(Task.FromResult(state));
  19. return state;
  20. }
  21. }
  22. }