How to logout from speckle via custom typescript-client?

Hi everyone,

I have a question regarding the “Creating Your Own App”-Post from the documentation.
I want to fully logout a user from speckle, when he clicks the logout button in my app. The user gets logged out in our app, but in speckle the user remains logged in. We have an automatic redirect to speckle, when a user enters our app. So whenever a user logs out, he instantly gets logged in again.

Any ideas? Can I do this via GraphQL maybe? I couldnt really find anything that sounded fitting in the explorer-documentation for GraphQL under mutations.

Thanks!

Why do you wish to do this? Is it to allow logging in with an alternative speckle account?

yupp. Some of our users might not understand that they would also have to log out from speckle client as well, when they want to switch users.

I ask as I think it would be a very unexpected user experience for anyone using your app who is also a Speckle user beyond just being a user of your app. Imagine logging out of Speckle also logged you out of Google, say.

For the switching-users case I think you’d want to handle that slightly differently where the UI was distinct rather than just bound to the Logout function. Or handle that User knowledge gap with hinting or explanation.


There is a logout endpoint on the Speckle Server ({SERVER_URL}/auth/logout) but it is protected from Cross-Origin requests (CORS). Were you running your own server, you could either amend this, or by running your App on the same domain as the server, this restriction wouldn’t apply.

There maybe a further alternative whereby you had a backend service running on your own infrastructure that can make direct API requests not from a web environment, but this is far beyond the scope of the tutorial you are referencing.

1 Like

Thank you.

I guess the thread can be closed.
I also thought of giving our users some feedback on the logout-process or change the process itself a bit.
It is maybe just a little bit confusing for them to press logout and immediately get logged in again :stuck_out_tongue:

Cheers!

1 Like