This commit is contained in:
MeysamMoghaddam
2025-10-12 18:16:59 +03:30
parent 707eac088a
commit 2497cec116
5 changed files with 250 additions and 271 deletions

View File

@@ -50,7 +50,16 @@ public static class ConfigureServices
{
var credentials = CallCredentials.FromInterceptor(async (context, metadata) =>
{
await Task.CompletedTask;
// Get token from local storage if available
var localStorage = serviceProvider.GetService(typeof(ILocalStorageService)) as ILocalStorageService;
if (localStorage != null)
{
var token = await localStorage.GetItemAsync<string>("auth:token");
if (!string.IsNullOrWhiteSpace(token))
{
metadata.Add("Authorization", $"Bearer {token}");
}
}
});
// SslCredentials is used here because this channel is using TLS.