401 Unauthorized

What it means

The thirdweb client ID or secret key was not provided or is restricted the API Key configuration.

Common examples:

  1. The domain is not configured in Allowed Domains.
  1. If building a mobile app, the bundle ID is not configured in Allowed Bundle IDs.
  1. If initializing the SDK from the backend, the secret key was not provided.

Solution

Allowed Domains

  1. Visit the settings for your API key on the thirdweb dashboard
    1. Notion image
  1. Click on the “Edit” Button and view the settings for allowed domains
    1. Notion image
  1. 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
          Notion image
       

Bundle IDs

  1. Visit the settings for your API key on the thirdweb dashboard
    1. Notion image
  1. Click on the “Edit” Button and under "Access Restrictions” head over to “Bundle IDs (iOS, Andriod, Games)
    1. Notion image
  1. Enter you app name in the “Allowed Bundle IDs” input & click on “Save”
    1. Notion image
      Notion image
 

Backend SDK

Provide the secret key when initializing the SDK:

const client = createThirdwebClient({
  secretKey: <thirdweb secret key>,
});
Did this answer your question?
😞
😐
🤩