I added project id and secret key, but still getting 401.
Here my ipfs.js
const { create } = require('ipfs-http-client');
const projectId = '2c011...'
const projectSecret = '7c6...'
const infura = {
host: 'ipfs.infura.io',
port: 5001,
protocol: 'https',
timeout: 15000,
method:'POST',
auth : projectId +':' +projectSecret,
};
const ipfs = create(infura);
async function uploadToIPFS(object) {
console.log('🛰 Sending to IPFS...');
try {
const ipfsResult = await ipfs.add(object);
const uploadPath = ipfsResult.path;
return uploadPath;
} catch (err) {
console.log("efefeffef");
console.log(err.message);
return '';
}
}
module.exports = {
uploadToIPFS,
};