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.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SpotifyHelper.cs 669B

123456789101112131415161718192021
  1. using Blazored.LocalStorage;
  2. using GrpcShared.DTO;
  3. using NemAnBlazor.Services.Interfaces;
  4. namespace NemAnBlazor
  5. {
  6. public static class SpotifyHelper
  7. {
  8. public static async Task<string?> TryRefreshToken(IAuthClientService authService, TokenMessage msg, ILocalStorageService localStorage)
  9. {
  10. var refreshResponse = await authService.RefreshAccessToken(msg);
  11. if (refreshResponse.AccessToken != null)
  12. {
  13. await localStorage.SetItemAsync<string>("token", refreshResponse.AccessToken);
  14. return refreshResponse.AccessToken;
  15. }
  16. else return null;
  17. }
  18. }
  19. }