We have a web server serving our Aurelia static files as well as an API, the server is protected by NTLM (using Integrated Windows Authentication on OWIN).
When using the Aurelia Fetch Client we can successfully hit the API with not problem. Here's the config we use:
constructor(private http: HttpClient){
http.configure(config => {
config
.withBaseUrl('api/')
.useStandardConfiguration();
});
However when we use the Aurelia Fetch Client we get the 401 (Unauthorized)
(seems the authorization header is missing)
constructor(private client: HttpClient) {
client.configure(cfg => {
cfg
.withBaseUrl('http://localhost:80/api/someEndpoint')
.withDefaults({
headers: {
'Accept' : 'application/json',
'X-Requested-With': 'Fetch'
}
})
Any ideas on how to resolve this are very much appreciated.
It turned out I was missing the credentials
:
constructor(private client: HttpClient) {
client.configure(cfg => {
cfg
.withBaseUrl('http://localhost:80/someEndpoint')
.withDefaults({
credentials: 'same-origin',
headers: {
'Accept' : 'application/json',
'X-Requested-With': 'Fetch'
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With