Home > Software design >  getting error : HTTPerror: basic auth header is Invalid ,when sending files to ipfs
getting error : HTTPerror: basic auth header is Invalid ,when sending files to ipfs

Time:01-26

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

CodePudding user response:

You need to add a space to Basic.

Modified code:

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