nftstorage / nft.storage

**Notice: Uploads Decommissioned - Existing Data is Safe!** NFT.Storage Classic (classic.nft.storage) offers free decentralized storage and bandwidth for NFTs on IPFS and Filecoin. June 2024 Update: No new uploads, but all existing data is safe. Try the new NFT.Storage, which preserves data in long term Filecoin storage. Go to app.nft.storage
https://classic.nft.storage
Other
619 stars 167 forks source link

ERROR_MALFORMED_TOKEN #2716

Closed giorgiomacho closed 2 months ago

giorgiomacho commented 2 months ago

I have updated the documentation to the latest version of the API and I keep getting this error

XHRPOST https://api.nft.storage/upload/ [HTTP/3 401 139ms]

ok false error Object { code: "ERROR_MALFORMED_TOKEN", message: "API Key is malformed or failed to parse." }

console.log got me this below:

Object { token: "b9c46fce.3a79a0w497ed460654fdf02eb167eaf1", endpoint: URL, rateLimiter: createRateLimiter() , did: undefined } ​ did: undefined ​ endpoint: URL { href: "https://api.nft.storage/", origin: "https://api.nft.storage/", protocol: "https:", … } ​​ hash: "" ​​ host: "api.nft.storage" ​​ hostname: "api.nft.storage" ​​ href: "https://api.nft.storage/" ​​ origin: "https://api.nft.storage/" ​​ password: "" ​​ pathname: "/" ​​ port: "" ​​ protocol: "https:" ​​ search: "" ​​ searchParams: URLSearchParams(0) ​​ username: "" ​​

: URLPrototype { toJSON: toJSON(), toString: toString(), href: Getter & Setter, … } ​ rateLimiter: function createRateLimiter() ​​ length: 0 ​​ name: "" ​​ : function () ​ token: "b9c46fce.3a79a0w497ed460654fdf02eb167eaf1" ​ : Object { … } ------- Error uploading image: Error: API Key is malformed or failed to parse. AbortError2 index.js:13 cid lib.js:227 pRetry2 index.js:50 attempt retry_operation.js:116 pRetry2 index.js:48 pRetry2 index.js:39 upload lib.js:202 mapAndQueue index.mjs:836 fillQueue index.mjs:822 next index.mjs:851 storeCar lib.js:243 store lib.js:302 store lib.js:711 uploadImage App.jsx:95 submitHandler App.jsx:45 React 15 callCallback2 invokeGuardedCallbackDev invokeGuardedCallback invokeGuardedCallbackAndCatchFirstError executeDispatch processDispatchQueueItemsInOrder processDispatchQueue dispatchEventsForPlugins dispatchEventForPluginEventSystem batchedUpdates$1 batchedUpdates dispatchEventForPluginEventSystem dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay dispatchEvent dispatchDiscreteEvent [localhost:5173:12714:25](http://localhost:5173/) overrideMethod (index):12714 uploadImage App.jsx:105 submitHandler App.jsx:45 React 15 callCallback2 invokeGuardedCallbackDev invokeGuardedCallback invokeGuardedCallbackAndCatchFirstError executeDispatch processDispatchQueueItemsInOrder processDispatchQueue dispatchEventsForPlugins dispatchEventForPluginEventSystem batchedUpdates$1 batchedUpdates dispatchEventForPluginEventSystem dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay dispatchEvent dispatchDiscreteEvent
elizabeth-griffiths commented 2 months ago

"API Key is malformed or failed to parse" is because an API key from https://app.nft.storage/login Is being used for https://classic.nft.storage/ (the API, SDK or NFTUp). API keys from https://app.nft.storage/login only work with https://app.nft.storage/login.

If you've purchased storage, it can be used to store data in the same login where you purchased it—app.nft.storage. First mint your NFTs then send us the NFT data—metadata and imagery CIDs, blockchain(s) minted on, contract address and token IDs. We store these in long term Filecoin storage. Note that you need to upload the data to IPFS separately, we recommend using Pinata or Lighthouse with our referral links to support NFT.Storage: https://nft.storage/blog/announcing-our-new-partnerships-with-pinata-and-lighthouse