401 Unauthorized
Error
401 Unauthorized
Error Reasons
- Domain is not listed in the "Allowed Domain" settings.
- If you're using an app, the bundle's allow list should match the app's bundle name.
secretKey
is not provided when using the SDK via the backend.
Solution
- For Allowed Domains
- Visit the settings for your API key on the thirdweb dashboard
- Click on the “Edit” Button and view the settings for allowed domains
- Enter your domain in the allowed domain section & save your settings.
- Use
*
to authorize all subdomains. Example: *.thirdweb.com accepts all sites ending in .thirdweb.com. - Enter
localhost:<port>
to authorize local URL
- For Bundle Allow List
- Visit the settings for your API key on the thirdweb dashboard
- Click on the “Edit” Button and under "Access Restrictions” head over to “Bundle IDs (iOS, Andriod, Games)
- Enter you app name in the “Allowed Bundle IDs” input & click on “Save”
- For Secret Key Issue
If you're utilizing the SDK from a backend, it's essential to provide a secretkey
instead of a clientId
. You can obtain a secret key from the thirdweb dashboard for proper authentication and security measures.
Example Code Block:
import { ThirdwebSDK } from "@thirdweb-dev/sdk"; const sdk = new ThirdwebSDK("sepolia", { secretKey: process.env.THIRDWEB_SECRET_KEY, });
That’s it, your issue is resolved now!
Can’t get this working? If you’ve followed the above and still have issues, contact our support team for help.
Did this answer your question?
😞
😐
🤩