MAUI-ba is jól bele lett rakva a Bearer token, ha van.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
using AutoMapper;
|
||||
using DevExpress.XtraPrinting.Native;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WorkFlowCheck.MAUI.DataLayer;
|
||||
@@ -31,5 +34,14 @@ namespace WorkFlowCheck.MAUI.Services
|
||||
var apiKey = configuration["ApiKey"];
|
||||
_httpClient.DefaultRequestHeaders.Add("X-Api-Key", apiKey);
|
||||
}
|
||||
protected async Task PrepareAuthenticatedRequestAsync()
|
||||
{
|
||||
var jwtToken = await SecureStorage.GetAsync("AuthToken");
|
||||
|
||||
if (!string.IsNullOrEmpty(jwtToken) && _httpClient != null)
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", jwtToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user