You're getting a 403 Forbidden error when uploading to IPFS via Pinata with the message:
"NO_SCOPES_FOUND": "This key does not have the required scopes associated with it"
Your Pinata JWT token doesn't have the required scopes/permissions to upload files to IPFS.
- Go to Pinata Dashboard: https://app.pinata.cloud/
- Navigate to API Keys: In the sidebar, click on "API Keys"
- Create a New API Key or Update Existing Key:
- Click "New Key" or edit your existing key
- Important: Make sure to enable these permissions:
- ✅ pinFileToIPFS (Required for file uploads)
- ✅ pinJSONToIPFS (Required for JSON uploads)
- ✅ unpin (Optional, for managing pins)
- ✅ userPinnedDataTotal (Optional, for quota checking)
- Copy the new JWT token
- Update your .env.local file with the new token
I've created a fallback implementation that you can use:
// Replace the import in your components
import { useIpfsWithFallback } from "@/hooks/useIpfsFallback";
// Use it the same way
const { uploadFile, uploadJson, isUploading } = useIpfsWithFallback();Add this to your component to test if your token works:
const { testAuthentication } = useIpfs();
// Call this to test your token
const testToken = async () => {
const isValid = await testAuthentication();
console.log("Token is valid:", isValid);
};Option A: Update your Pinata key (5 minutes)
- Go to Pinata dashboard
- Create new API key with file upload permissions
- Replace the JWT in
.env.local - Restart your dev server:
npm run dev
Option B: Use the fallback implementation (1 minute)
# In your terminal
cd /home/hxrshxz/Desktop/Projects/CyFutureAI/Cyfuture-LandingPageThen update your imports in:
app/dashboard/page.tsxcomponents/cyfuture/Dashboard.tsx
Change:
import { useIpfs } from "@/hooks/useIpfs";To:
import { useIpfsWithFallback as useIpfs } from "@/hooks/useIpfsFallback";When creating a Pinata API key, ensure these scopes are enabled:
pinFileToIPFS- Upload filespinJSONToIPFS- Upload JSON datauserPinnedDataTotal- Check usage statspinList- List your pinsunpin- Remove pins (optional)
Your .env.local should have:
NEXT_PUBLIC_PINATA_JWT=your_working_jwt_token_here
NEXT_PUBLIC_IPFS_GATEWAY=https://gateway.pinata.cloud/ipfsAfter making changes, test the upload functionality:
- Restart your development server
- Try uploading a file through your dashboard
- Check the browser console for success/error messages
If you continue having issues:
- Verify your Pinata account is active
- Check if you have sufficient Pinata storage quota
- Try creating a completely new API key
- Consider switching to Web3.Storage or another IPFS provider