Hi, was wondering how would I setup supertokens an...
# support-questions-legacy
m
Hi, was wondering how would I setup supertokens and websockets? I've already got my supertokens working fine. But I'm wanting to try and incorporate websocket. I'm currently using nestJS as my backend - frontend isn't completed yet but is using Vite (React). I have some basic handlers for my websockets (when someone sends a message), but was wondering how do I setup guards / logging in etc?
So I have something along the lines of this for my endpoints....
Copy code
TS
    @Get('me')
    @UseGuards(AuthGuard)
    async getUser(@Session() session: SessionContainer) {
        return this.userService.getUserInfo(session.getUserId());
    }
How would I setup authentication for my websocket?
m
I've tried that... but when I try and add
exposeAccessTokenToFrontendInCookieBasedAuth
to my backend... I'm just getting an error... TS2345: Argument of type '{ antiCsrf: "NONE"; cookieSameSite: "strict"; getTokenTransferMethod: () => "cookie"; exposeAccessTokenToFrontendInCookieBasedAuth: boolean; }' is not assignable to parameter of type 'TypeInput'.   Object literal may only specify known properties, and 'exposeAccessTokenToFrontendInCookieBasedAuth' does not exist in type 'TypeInput'.
r
which version of the backend SDK are you using?
m
supertokens-node": "^13.6.0
r
right. So the guide is for verison 14+. You could update your backend SDK to the latest version (and the core). or, you could search discord for older threads for this, or see our github docs commit history for how to enable JWT in older versions. Here is the link to the github for the docs: https://github.com/supertokens/docs
m
what core version would I need for 14+?
r
5.0
m
I guess I'll send another email 😆
r
right ok. We will make the upgrade on Monday
m
oh, could I just host it myself instead?
r
yea, ofc. That's always an option
m
Thanks
r
Which version of the backend SDK? Also, can you enable backend debug logs and show the output when calling this api?
m
I'm now using
^14.1.1
and my core is
5.0
r
Right.
What’s the apiBasePath that you have set in your app info?
m
ah that'll be why
I didn't
thx
14 Views