401 Unauthorized
What it means
The thirdweb client ID or secret key was not provided or is restricted the API Key configuration.
Common examples:
- The domain is not configured in Allowed Domains.
- If building a mobile app, the bundle ID is not configured in Allowed Bundle IDs.
- If initializing the SDK from the backend, the secret key was not provided.
Solution
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
Bundle IDs
- 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”
Backend SDK
Provide the secret key when initializing the SDK:
const client = createThirdwebClient({
secretKey: <thirdweb secret key>,
});
Did this answer your question?
😞
😐
🤩