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 887B

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