error create token HTTPError: project id required

Hi Community ,
i have issue for add new file on IPFS, it’s works for me for 6 month but today is suddenly stoped and give me error as below :slight_smile:

error create token HTTPError: project id required

    at Object.errorHandler [as handleError] (core.js:84:1)
    at async Client.fetch (http.js:149:1)
    at async addAll (add-all.js:22:1)
    at async Object.last [as default] (index.js:13:1)
    at async Object.add (add.js:18:1)
    at async Erc721Action.js:49:1

Can you help me what the exact issue here.

and also issue when i get from IPFS url error as below:

Public Gateway Is Not Supported Anymore - Setup a Dedicated Gateway

Same error here

  const client = ipfsHttpClient(
    "http://ipfs.io:5001/api/v0/add?recursive=false&quiet=<value>&quieter=<value>&silent=<value>&progress=<value>&trickle=<value>&only-hash=<value>&wrap-with-directory=<value>&hidden=<value>&chunker=<value>&pin=true&raw-leaves=<value>&nocopy=<value>&fscache=<value>&cid-version=0&hash=sha2-256"
  );

Hello there,

Make sure you are passing authentication when making requests.
Project id and project secret are required when using Infura IPFS.

I’m also getting this error, also started a few hours ago when it was working fine yesterday

I’m using the JS ipfs-http-client library with a create of…

const ipfs = create({
  host: 'ipfs.infura.io',
  port: 5001,
  protocol: 'https',
  headers: {
    authorization:
      'Bearer XXXXX',
  },
})

Where the Bearer XXXXX is the project ID and secret from the admin, separated with a colon and converted to base64.

@rik Try this one:

const ipfsClient = require("ipfs-http-client");

const projectId = '...'
const projectSecret = '...'

async function main() {

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

 const client = await ipfsClient.create({
    host: 'ipfs.infura.io',
    port: 5001,
    protocol: 'https',
    apiPath: '/api/v0',
    headers: {
      authorization: auth
    }
  })

try {
    const file = await client.add('test.jpg')
    console.log(file)

    } catch (error) {
      console.log(error)
    }

}
main();

Thanks @lovekosmas! I think I was using Bearer instead of Basic in the auth, which would explain it!

1 Like

yes, Basic auth would do it.

Thanks for confirming!

Hi, despite trying this it seems like I am still getting this error “basic auth failure: invalid project id or project secret”. I have triple checked the project id (API key) and project secret (API secret) but it still doesn’t work… any idea on this?