Back

[SOLVED] Cannot add an user to a team through server SDK

  • 0
  • Teams
  • Self Hosted
D5
16 Oct, 2023, 15:48

Sending in 5 min πŸ˜…

TL;DR
User was experiencing an issue with adding a user to a team through the server SDK. The problem was that the user had not enabled all the necessary API scopes, specifically for the teams API. The user made a small mistake and forgot to add a semicolon in their code. The solution was to add "await" and check the logs for any errors. The user also tried specifying a role and using an ID instead of an email, but these did not work. Finally, the code that successfully added a user to the team was shared. The issue was resolved and the user apologized for the delay.
Drake
16 Oct, 2023, 16:52

I think it was made optional in 1.4

Binyamin
16 Oct, 2023, 16:58
D5
16 Oct, 2023, 17:23

Here I am, so the code to send it is:

TypeScript
try{

teams.createMembership(
  teamId: "teamID", 
  email: "contacto@dh-sw.net",      
  roles: [], 
  url: "https://inicio.dh-sw.net");

} catch(e){

print(e)

}
D5
16 Oct, 2023, 17:23

Sorry for the delay, It took me longer than expected πŸ˜…

D5
16 Oct, 2023, 17:24

Maybe the issue is not specifying roles?

Binyamin
16 Oct, 2023, 17:34

No that should work

Binyamin
16 Oct, 2023, 18:10

What dart SDK you're using?

D5
16 Oct, 2023, 18:11

7.1.0

Binyamin
16 Oct, 2023, 18:12

Try to use ID instead of email Is it working?

D5
16 Oct, 2023, 18:38

trying now

D5
16 Oct, 2023, 18:44

Nope, no luck 😒

D5
16 Oct, 2023, 18:46

Tried specifying a role, and no luck

D5
16 Oct, 2023, 19:07

Okay, solved

Binyamin
16 Oct, 2023, 19:07

Can you

  1. add await then check the e
TypeScript
await teams.createMembership(
  1. check the logs?
Binyamin
16 Oct, 2023, 19:07

Ohh

Binyamin
16 Oct, 2023, 19:07

Great

Binyamin
16 Oct, 2023, 19:08

How?

D5
16 Oct, 2023, 19:08

API scopes πŸ˜­πŸ˜΅β€πŸ’«

Binyamin
16 Oct, 2023, 19:08

πŸ‘

D5
16 Oct, 2023, 19:08

Sincerely a dumb mistake πŸ˜†

Binyamin
16 Oct, 2023, 19:08

Those are the most common

D5
16 Oct, 2023, 19:09

Yes. I thought I had enabled all scopes. Then double checked and saw it was disabled just for teams API πŸ€¦β€β™‚οΈ

Binyamin
16 Oct, 2023, 19:09

I remember when first learning C, the author wrote "everyone will forget to add ;" I though I wouldn't. but I did, many times.

D5
16 Oct, 2023, 19:24

[SOLVED] Cannot add an user to a team through server SDK

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