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.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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. }