Skip to content
Back

User (role: guests) missing scopes

  • 0
  • Web
  • Cloud
remy
4 Sep, 2025, 21:44

Encountering a 401 Unauthorized error when attempting to create users

AI assistant suggested I need to create a "server" type API key instead of the current "standard" prefixed key, but my Appwrite console doesn't show any option to select API key types.

Environment

  • Appwrite Cloud (NY server region)
  • node-appwrite: v13 (downgraded)
  • Frontend framework: NextJs

Troubleshooting Steps Taken

  • Downgraded node-appwrite SDK to v13
  • Recreated API keys
  • Created mock user for testing - works successfully with mock data
  • Researched Appwrite Discord
  • Verified environment var configuration

Current API Key Configuration

  • All available scopes are selected
  • Key is properly configured in env variables

Suspected Issues Server region selection - NY server region compatibility issues

Frontend architecture compatibility - Current build approach may not be compatible with recent Appwrite updates

UserActions.ts

TypeScript
  try {
    if (!users) {
      throw new Error("");
    }
    const newUser = await users.create(
      ID.unique(),
      user.email,
      user.phone,
      user.name
    );
    return parseStringify(newUser);
  } catch (error: any) {
    if (error...) {
      const documents = await users.list([Query.equal("email", [user.email])]);
      return documents.users[0];
    }
    console.error("", error);
    throw error;
  }```

***RegisterForm.tsx***
```const onSubmit = async (form validation) => {
    setIsLoading(true);
    try {
      const user = {
        name: values.name,
        email: values.email,
        phone: values.phone,
      };
      const newUser = await createUser(user);

      if (newUser) {
router.push(`user endpoint`);
      }
    } catch (error) {
      console.log(error);
    }
   };```

**Questions**
1. Are there known compatibility issues between FE impl. and specific server regions?

2. Has the API key creation process changed in  Appwrite?
TL;DR
Developers are facing a 401 Unauthorized error when creating users due to missing scopes. The Appwrite console doesn't show an option to select API key types. Downgraded to node-appwrite v13, recreated API keys, and checked environment var configuration. Issue may be due to server region selection or frontend architecture compatibility. Need to consider server region compatibility and check for changes in API key creation process in Appwrite.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more