401 Unauthorized

Error

401 Unauthorized

Error Reasons

  1. Domain is not listed in the "Allowed Domain" settings.
  1. If you're using an app, the bundle's allow list should match the app's bundle name.
  1. secretKey is not provided when using the SDK via the backend.

Solution

  • For 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
           
  • For Bundle Allow List
      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
  • 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?
😞
😐
🤩