0

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.

some-user
  • 3,888
  • 5
  • 19
  • 43
iBeiros
  • 1
  • 1
  • Have you checked https://stackoverflow.com/questions/43842793/basic-authentication-with-fetch? Is your account enabled for the API? Have you tried with `curl`? – some-user Oct 09 '22 at 17:40
  • I have exactly this code snippet used for it with curl I have it yet nciht tried have found no template ... – iBeiros Oct 10 '22 at 07:12

0 Answers0