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 символов.

Callback.razor 887B

1234567891011121314151617181920212223242526272829303132
  1. @page "/callback"
  2. @using NemAnBlazor.Services.Interfaces
  3. @inject NavigationManager NavigationMgr
  4. @inject IAuthClientService AuthService
  5. @inject Blazored.SessionStorage.ISessionStorageService sessionStorage
  6. <PageTitle>Redirecting...</PageTitle>
  7. <p role="status">Loading...</p>
  8. @code {
  9. protected override async Task OnInitializedAsync()
  10. {
  11. string url = NavigationMgr.Uri;
  12. //code is the only parameter in the url
  13. string code = url.Split("=")[1];
  14. var response = await AuthService.GetAccessToken(new GrpcShared.DTO.Auth.TokenRequest { code = code});
  15. //store access token in local storage
  16. await sessionStorage.SetItemAsync("token", response.access_token);
  17. await sessionStorage.SetItemAsync("refresh_token", response.refresh_token);
  18. //redirect to home
  19. NavigationMgr.NavigateTo("/home");
  20. }
  21. }