These forums are your way of communicating with the community of people developing and using tools provided by the OneAll platform. The forums are run by the community and moderated by the OneAll team during office hours.
Please stick to technical issues - and remember, no confidential information - these are public forums!

Getting connections with fetch

edited August 20 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

  • edited August 21 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

    Sign In or Register to comment.