Rank 1: Thread
here's my code :
void inviteToBecomeManager(User user) async{ await client_aw.Teams(ClientDatabase.client!).createMembership( teamId: 'managers', roles: [''], email: user.email, userId: user.$id, phone: user.phone, name: user.name, url: '$link?projectId=$project&endpoint=$endpoint}' ).then((value) { f.showDialog( barrierDismissible: true, context: current, builder: (co){ return const Text('invitationsent').tr(); }); }).onError((client_aw.AppwriteException error, stackTrace) { if(kDebugMode){ print('===================================================='); print('error sending invitation'); print('type: ${error.type}'); print('code: ${error.code}'); print('message: ${error.message}'); print('response: ${error.response}'); print('stacktrace: $stackTrace'); print('====================================================');
} }); }and the error
type: user_unauthorized
code: 401
message: User is not allowed to send invitations for this team
response: {message: User is not allowed to send invitations for this team, code: 401, type: user_unauthorized, version: 0.12.20}
stacktrace: #0 ClientMixin.prepareResponse (package:appwrite/src/client_mixin.dart:73:9)
#1 ClientIO.call (package:appwrite/src/client_io.dart:373:14)
<asynchronous suspension>
#2 Teams.createMembership (package:appwrite/services/teams.dart:187:17)
<asynchronous suspension>
#3 UsersManagementDatasource.inviteToBecomeManager.<anonymous closure> (package:parc_oto/datasources/user_management/user_datasource.dart:138:12)
<asynchronous suspension>
#4 UsersManagementDatasource.inviteToBecomeManager (package:parc_oto/datasources/user_management/user_datasource.dart:130:5)
<asynchronous suspension>
The account is sent the invitation with is the creator of the team, and a member