Skip to content
Back

Not allowed permission to upsert a presence.

  • 0
  • Web
  • Realtime
  • Cloud
Remi
6 Jun, 2026, 08:46
TypeScript
const presenceID = ID.unique();
    setPID(presenceID);
    const presence = await presences.upsert({
      presenceId: presenceID,
      status: "online",
    });

returns this in network

TypeScript
code: 401
message: "The current user is not authorized to perform the requested action."
type: "user_unauthorized"
version: "1.9.5"
TL;DR
Presence upsert permission issue possibly due to missing presence API scope in the API key settings. Ensure correct permissions are set and user is authenticated before creating a presence. If experiencing problems, try using a server SDK and double-check permissions. If persisting, consider utilizing server-side methods and API key for troubleshooting.
π”Έπ•π•¨π•’π•§π•–πŸ˜πŸŸ ✨
6 Jun, 2026, 09:04

Have you added the presence API scope in the API key settings?

Arnab Chatterjee
6 Jun, 2026, 10:21

Two things can make it happen

  1. You upserted the presence before with a read only permission.
  2. You forgot to add correct scopes
Remi
6 Jun, 2026, 16:49

Im using default permissions, and how do I check scopes cuz i believe its setup right but not 100% sure

Remi
6 Jun, 2026, 16:50

Everything is client sided so I dont have any api key

Arnab Chatterjee
6 Jun, 2026, 16:56

Are you authenticated? I mean do you have an active session? Before creating a presence for the user, the user must be authenticated

Remi
6 Jun, 2026, 16:57

yeah, Even of I have the session and reload the page so the user is definitely logged in before hand it still does that

Arnab Chatterjee
6 Jun, 2026, 17:05

Are you able to get the presence? If no? Then try to use a server SDK And check the permission once

Remi
6 Jun, 2026, 17:24

Ok, so it's randomly working now, which is weird because nothing changed

Arnab Chatterjee
6 Jun, 2026, 17:32

I guess, you set the wrong permission TTL expired and a new presence upserted with default perms

Arnab Chatterjee
6 Jun, 2026, 17:32

Again if it happens, make a get/list and share the permissions it's having And if it's not coming with client SDK Please use the server side with api key for grabbing the presence perms and share here

Remi
6 Jun, 2026, 17:33

Yeah, thats what im thinking

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