Back

How to get all users' Identities, without active session

  • 0
  • Databases
  • Flutter
  • Functions
Ankit Maniya
18 Feb, 2025, 23:54

I have below GET request "/auth-users" endpoint. Which can get all the users and I want to list Identities. But right now I am getting error like AppwriteException: general_unauthorized_scope, app.23sefesf32r23rwewefwe@service.cloud.appwrite.io (role: applications) missing scope (account) (401)

is there any way to get all the Identities without active session for all the users?

if (request.method == 'GET') { if (request.path == "/auth-users") { final client = Client() .setEndpoint( Platform.environment['APPWRITE_FUNCTION_API_ENDPOINT'] ?? '') .setProject( Platform.environment['APPWRITE_FUNCTION_PROJECT_ID'] ?? '') .setKey(context.req.headers['x-appwrite-key'] ?? ''); final users = Users(client); // Account account = Account(client);

TypeScript
    final userdata = await users.list();
    context.log('Total users: ${userdata.total}');

    // How can I get all the Identities
    // IdentityList userIdentityList = await account.listIdentities();
    // context.log('Total identities: ${userIdentityList.total}');

} }

TL;DR
Developers are trying to get all Identities from users without an active session, encountering an authorization error. The solution is to include the 'account' scope in their API key permissions when calling the "/auth-users" endpoint to access user Identities.
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