POST https://ipfs.infura.io:5001/api/v0/add?stream-channels=true&progress=false 401 (Unauthorized)

POST https://ipfs.infura.io:5001/api/v0/add?stream-channels=true&progress=false 401 (Unauthorized)
External Image
I’m getting this error while trying to upload a file to IPFS. I have no idea where the error lies.

This is the GitHub repo of complete code
https://github.com/abhijit69-ui/nft_marketplace

3 Likes

Hi @abhijit69-ui and welcome to the community.

It seems you are not authenticating your request, hence the 401 unauthorized error. Please use your project Id and project secret to authenticate. You can use the below as an example:

curl "https://ipfs.infura.io:5001/api/v0/add?pin=false" \
    -X POST \
    -u "PROJECT_ID:PROJECT_SECRET" \
    -H "Content-Type: multipart/form-data" \
    -F file=@"/sample-result.json"
2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.