I try to get team of a user inside appwrite function, but i get this error:
AppwriteException: User (role: guests) missing scope (teams.read)
If i try on client side, it's working fine. I don't understand why.
There is my cloud function sample code
import { Client, Teams } from "node-appwrite";
//... inside function
const userJwt = req.headers["x-appwrite-user-jwt"];
const client = new Client()
.setEndpoint("https://cloud.appwrite.io/v1")
.setProject(process.env.APPWRITE_PROJECT_NAME)
.setSession(userJwt);
log('X')
const teams = new Teams(client);
log('Y')
const listTeam = await teams.list(); // <-- It's failed
log('Z') // <-- Didn't get this log
It's working on client side
import { Client, Teams } from "appwrite";
const client = new Client();
client
.setEndpoint("endpoint") // Your Appwrite Endpoint
.setProject("projectid"); // Your project ID
export const teams = new Teams(client);
const teamslist = await teams.list();
console.log(teamslist); // <-- get the team of the user
On appwrite function i try to get the team of the same user
@D5 there are here i have shared code that lead to auto block =/
role: guests this means you're unauthenticated.
setSession(userJwt) you shouldn't be passing the JWT to setSession(). it should be setJWT()
Recommended threads
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Appwrite Storage error 503s for automate...
I'm facing error 503s from Appwrite after about 5-6 seconds of making AI requests from my tool with images and files above 20MB (=> not inline base64 used, but ...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...