Getting connections with fetch

edited August 2018 in Social Login

Seems like this should be simple, but I always get a 401 unauthorized response. I am using the correct endpoint and my public and private keys for the username and password. I have also tried base64 encoding the username/password combination. Note I have removed the backticks around the template literal because they mess up the formatting of this post. Also, the fetch is node-fetch, since this must be run on a server.

fetch(${endpoint}/connections/${connection_token}.json,{headers:{"Authentication":"Basic " + username + ":" + password}})
.then(response => { console.log(response.ok); console.log(response.status); return response.json(); } )

Best Answer

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited August 2018 Answer ✓

    Hi Simon,

    the header is not Authentication but Authorization.

    Example:
    Authorization: Basic dXNlcjpwYXNzd29yZA==

    The hash is obtained by base64 encoding public_key:private_key

    Welcome!

    Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

    Please click on the link below to connect to the forum with your OneAll account.