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.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SpotifyHelper.cs 944B

12345678910111213141516171819202122232425262728293031
  1. using Blazored.LocalStorage;
  2. using GrpcShared.DTO;
  3. using GrpcShared.DTO.Db;
  4. using NemAnBlazor.Services.Interfaces;
  5. namespace NemAnBlazor
  6. {
  7. public static class SpotifyHelper
  8. {
  9. public static async Task<string?> TryRefreshToken
  10. (IAuthClientService authService,
  11. TokenMessage msg,UserResponse user,
  12. ILocalStorageService localStorage,
  13. IIdentityClientService identityService)
  14. {
  15. var refreshResponse = await authService.RefreshAccessToken(msg);
  16. if (refreshResponse.AccessToken != null)
  17. {
  18. await identityService.UpdateTokenAsync(new UserResponse
  19. {
  20. Id = user.Id,
  21. Token = refreshResponse.AccessToken,
  22. RefreshToken = user.RefreshToken
  23. });
  24. return refreshResponse.AccessToken;
  25. }
  26. else return null;
  27. }
  28. }
  29. }