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.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Callback.razor 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. @page "/callback"
  2. @using NemAnBlazor.Services.Interfaces
  3. @inject NavigationManager NavigationMgr
  4. @inject IAuthClientService AuthService
  5. @inject Blazored.SessionStorage.ISessionStorageService sessionStorage
  6. <PageTitle>Callback page</PageTitle>
  7. <p role="status">Current count: @currentCount</p>
  8. <button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
  9. @code {
  10. private int currentCount = 0;
  11. private void IncrementCount()
  12. {
  13. currentCount++;
  14. }
  15. protected override async Task OnInitializedAsync()
  16. {
  17. string url = NavigationMgr.Uri;
  18. //code is the only parameter in the url
  19. string code = url.Split("=")[1];
  20. var response = await AuthService.GetAccessToken(new GrpcShared.DTO.Auth.TokenRequest { code = code});
  21. //store access token in local storage
  22. await sessionStorage.SetItemAsync("token", response.access_token);
  23. await sessionStorage.SetItemAsync("refresh_token", response.refresh_token);
  24. //redirect to home
  25. NavigationMgr.NavigateTo("/home");
  26. }
  27. }