@page "/callback"
@using NemAnBlazor.Services.Interfaces
@inject NavigationManager NavigationMgr
@inject IAuthClientService AuthService
@inject Blazored.LocalStorage.ILocalStorageService localStorage
Loading...
@code { protected override async Task OnInitializedAsync() { string url = NavigationMgr.Uri; //code is the only parameter in the url string code = url.Split("=")[1]; var response = await AuthService.GetAccessToken(new GrpcShared.DTO.Auth.TokenRequest { Code = code}); //if (response.access_token == null) NavigationMgr.NavigateTo("/"); //store access token in local storage await localStorage.SetItemAsync("token", response.AccessToken); await localStorage.SetItemAsync("refresh_token", response.RefreshToken); //redirect to home NavigationMgr.NavigateTo("/home"); } }