Ipfs-http-client

Hey, I am trying to add files to IPFS by using your tutorial code and getting this error:
Error: basic auth failure: invalid project id or project secret
What I am doing wrong?
Have checked projectId and projectSecret, even add new project and no luck…

The code I’m using:

const ipfsClient = require(‘ipfs-http-client’)

const projectId = ‘1qmt…XXX’
const projectSecret = ‘c920…XXX’
const auth =
'Basic ’ + Buffer.from(projectId + ‘:’ + projectSecret).toString(‘base64’)

const client = ipfsClient({
host: ‘ipfs.infura.io’,
port: 5001,
protocol: ‘https’,
headers: {
authorization: auth
}
})

client.pin.add(‘QmeGAVddnBSnKc1DLE7DLV9uuTqo5F7QbaveTjr45JUdQn’).then((res) => {
console.log(res)
})

Thank you for your help!.

Have luck when I don’t use authorization

const client = ipfsClient({
host: ‘ipfs.infura.io’,
port: 5001,
protocol: ‘https’
})

Any solution? Thank you

hi @red07home what ipfs-http-client version are you using ?
Can you also make sure that you’re not using an ETH projectID, you should be seeing that under ipfs in your dashboard, ex: https://infura.io/dashboard/ipfs/<insert_projectid_here>/settings

Traian