getting error : HTTPerror: basic auth header is Invalid ,when sending files to ipfs

226 views Asked by At
const projectId = process.env.PROJECTKEY
const projectSecret =process.env.SECRETKEY
const auth = 'Basic' + Buffer.from(projectId + ":" + projectSecret).toString('base64')


const client = IPFSHTTPClient({
  host:'infura-ipfs.io',
  port:5001,
  protocol:'https',
  headers:{
      authorization: auth
  }
  
  
})

i removed headers object and then got error- project id required

1

There are 1 answers

0
enobeeeeee On BEST ANSWER

You need to add a space to Basic.

Modified code:

const auth = 'Basic ' + Buffer.from(projectId + ":" + projectSecret).toString('base64')