Back

Help with logout and Teams

  • 0
  • Users
  • Teams
  • Web
RangerDev
26 Dec, 2023, 18:51

Hello! I am trying to make the user log out but its not working. Here is the error I am getting: This is the code for the logout:

TypeScript
    async function logout() {
        if (isLoggedin) {
            try {
                await appwriteUser.deleteSession('current');
            } catch (error) {
                console.error('Failed to logout:', error);
            }
        } else {
            console.error('User is not logged in');
        }
    }

I also need help with teams... I want the user to join a team as soon as they log in: here is the code:

TypeScript
            await appwriteUser.create(ID.unique(), email, password, name).then(async () => {
                await appwriteTeams.createMembership(
                    'Teachers',
                    email
                )

yet this dcoes not work. please help!

TL;DR
The user is seeking help with logging out of Teams but has not provided any further details.
RangerDev
26 Dec, 2023, 18:53

please help!

abel_banze
26 Dec, 2023, 18:56

Seems like you are running that logout code in server-side. Try to run on client-side

RangerDev
26 Dec, 2023, 18:56

how do I do that?

RangerDev
26 Dec, 2023, 18:56

do I try to run it in prod?

abel_banze
26 Dec, 2023, 18:57

Are coding in Nextjs?

RangerDev
26 Dec, 2023, 18:58

sveltekit

RangerDev
26 Dec, 2023, 18:59

what about the teams thing tho?

abel_banze
26 Dec, 2023, 19:02

I'm not expert in that framework. try to use bard or bing-chatgpt to find better approach. In my case when the similar error I just switched to client-side and solved the problem

RangerDev
26 Dec, 2023, 19:04

ok

ideclon
26 Dec, 2023, 20:03

It looks like you don’t currently have an active session to delete

ideclon
26 Dec, 2023, 20:03

As for the Teams, only owners of a team can add users to the Team

RangerDev
26 Dec, 2023, 20:14

oh

RangerDev
26 Dec, 2023, 20:14

is there a way to automate the process?

RangerDev
26 Dec, 2023, 20:14

or is it manual?

ideclon
26 Dec, 2023, 20:16

You could have a Function that triggers on user login?

RangerDev
26 Dec, 2023, 20:25

an appwrite function or a ts function

ideclon
26 Dec, 2023, 20:40

Appwrite

RangerDev
26 Dec, 2023, 20:46

oh alr\

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