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
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2F86a0eec2-a5db-4173-96cc-69fa87da4269%2FUntitled_(2).png?table=block&id=58b89181-a4ef-4705-a329-c1db3515bc92&cache=v2)
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2F6afff106-3358-49da-bcfc-ebad8f2e3351%2FUntitled.png?table=block&id=889b2dad-ed33-4d2d-a759-77bb822a6d00&cache=v2)
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2F7d7e2b84-0186-4c39-852c-6102d5d48ff7%2FUntitled.png?table=block&id=d5fbe0b8-7ba4-414f-a9d8-9b4e6502d988&cache=v2)
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2Fb8cbf72e-da92-4836-8181-78abe30683d0%2FUntitled_(3).png?table=block&id=5d0a7621-bca3-4fd1-9bb6-38668ee8f8df&cache=v2)
- 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”
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2F86a0eec2-a5db-4173-96cc-69fa87da4269%2FUntitled_(2).png?table=block&id=1095d18c-dca3-43b6-91ba-c42ab8f4f772&cache=v2)
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2F07f4b638-43f9-423d-9c51-ca9a73af6aaf%2FUntitled.png?table=block&id=e6ab5668-5a15-430e-9ca9-e6e54c8232df&cache=v2)
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2Fbe9fda6e-b2c1-40da-b3fb-bfd8a6a7cc10%2FUntitled.png?table=block&id=c4b80ae1-b93c-4ab7-b90a-e1b82bc5fe21&cache=v2)
![Notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff6d1ff84-8c0e-4bcb-8dd6-edab3b3c175b%2F22ac1721-35a0-4a14-a850-3628e4b5a86e%2FUntitled.png?table=block&id=d8115e85-943b-46bd-bec7-19946073788a&cache=v2)
- 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?
😞
😐
🤩