i have a problem with authentication it says i am unauthenticated
I have already tried like pben in the example to specify username and password but I get no authentication.
Here is another link to the authentication page of the mobile.de site
https://services.mobile.de/docs/seller-api.html#_authentication_and_authorization
let url = 'https://services.mobile.de/seller-api/sellers/sellerid/ads';
let username = 'username';
let password = 'password';
let headers = new Headers();
headers.set('Authorization', 'Basic ' + base64.encode(username + ":" + password));
fetch(url, {method:'GET',
headers: headers,
})
.then(response => console.log(response))
i get this in my Console
Response {
size: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
stream: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
boundary: null,
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
type: 'default',
url: 'https://services.mobile.de/seller-api/sellers/mobileID/ads',
status: 401,
statusText: 'Unauthorized',
headers: {
connection: 'close',
'content-length': '0',
date: 'Thu, 06 Oct 2022 23:52:28 GMT',
'www-authenticate': 'Basic realm="mobile.de api"'
},
counter: 0,
highWaterMark: 16384
}
}
Response {
size: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
stream: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
boundary: null,
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
type: 'default',
url: 'https://services.mobile.de/seller-api/sellers/mobileid/ads',
status: 401,
statusText: 'Unauthorized',
headers: {
connection: 'close',
'content-length': '0',
date: 'Thu, 06 Oct 2022 23:52:28 GMT',
'www-authenticate': 'Basic realm="mobile.de api"'
},
counter: 0,
highWaterMark: 16384
}
}
I have only worked with Directus RestAPI before.