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.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Login.razor 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. @page "/"
  2. @using Grpc.Net.Client
  3. @using Grpc.Net.Client.Web
  4. @using GrpcShared
  5. @using GrpcShared.DTO.Auth
  6. @using GrpcShared.DTO.Search
  7. @using NemAnBlazor.Services.Interfaces
  8. @inject NavigationManager NavigationManager
  9. @inject IAuthClientService AuthService
  10. @inject ITrackClientService SearchService
  11. @using System.Security.Claims
  12. <AuthorizeView>
  13. <Authorized>
  14. Dobrodosli @context.User.Claims.FirstOrDefault(x => x.Type == "name")?.Value.ToUpper()
  15. </Authorized>
  16. <NotAuthorized>
  17. Nisi autorizovan.
  18. <button class="btn btn-primary" @onclick="LoginUser">Autorizuj</button>
  19. </NotAuthorized>
  20. </AuthorizeView>
  21. <PageTitle>Index</PageTitle>
  22. <h1>Pozdrav Diligent!</h1>
  23. Dobrodošli u našu NemAn aplikaciju.
  24. @code {
  25. private string message;
  26. protected override async Task OnInitializedAsync()
  27. {
  28. message = "Cao";
  29. }
  30. private async Task LoginUser()
  31. {
  32. //var response = await SearchService.GetListSearchAsync(new GrpcShared.DTO.Search.SearchRequest() { Query="venom", Type = "track"});
  33. CodeRequest authParams = await AuthService.GetAuthParams();
  34. // await AuthService.GetAccessToken(new CodeResponse{ Code = "hello"});
  35. string url = $"https://accounts.spotify.com/en/authorize?client_id={authParams.ClientId}&redirect_uri={authParams.RedirectURI}&response_type={authParams.ResponseType}&scope={authParams.Scope}&show_dialog={authParams.ShowDialog}";
  36. NavigationManager.NavigateTo(url);
  37. }
  38. }