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.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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. }