https://supertokens.com/ logo
#general
Title
# general
k

KitsuneKenshi

04/29/2022, 4:39 PM
Hey, I'm upgrading my app to nuxt3 and trying to figure out how to implement SuperTokens into their new routing system. I was trying to find a way of implementing express configuration into that but it didn't work out. Is it possible rn or do I have to wait for an update on SuperTokens?
Hey, I'm upgrading my app to nuxt3 and trying to figure out how to implement SuperTokens into their new routing system. I was trying to find a way of implementing express configuration into that but it didn't work out. Is it possible rn or do I have to wait for an update on SuperTokens?
Update to the thread: I started looking which package Nuxt3 uses for routing and found out it's H3. And right now I'm trying to add it to SuperTokens by myself. Whish me luck
Another Update: I have figured out how to create sessions on h3. Everything seems to work for now
r

rp

04/30/2022, 4:57 AM
Thanks @KitsuneKenshi. Would you mind sharing an example of it?
k

KitsuneKenshi

04/30/2022, 7:24 AM
You can see my progress on one of forks I have made, my nickname is kall7 on GitHub
Hey, I have a question about /auth/refresh. I couldn't find where you implement it and it causes issues with integrating it with h3
r

rp

04/30/2022, 9:58 AM
It’s exposed as one of the APIs of the session recipe
When u add the supertokes middleware to your app
k

KitsuneKenshi

04/30/2022, 10:12 AM
Alright. So I have issue with refreshing tokens, I'm not sure where exactly the issue is cuz, console logs doesn't show up. Even test console log in middleware didn't show up.
r

rp

04/30/2022, 10:12 AM
Hmmmm. Can you enable debug logging on the backend SDK and see the output?
k

KitsuneKenshi

04/30/2022, 10:14 AM
Where do i turn it on? cuz I can't find debug option
r

rp

04/30/2022, 10:14 AM
See troubleshooting section in docs
k

KitsuneKenshi

04/30/2022, 10:23 AM
I'm getting no logs, only when starting app and that's all
r

rp

04/30/2022, 10:24 AM
It means that the refresh api call is not reaching the middleware
k

KitsuneKenshi

04/30/2022, 10:26 AM
huh. that's weird cuz yesterday when I was testing session creation everything was fine
alright i fixed it
Well I got this after figuring out few things
r

rp

04/30/2022, 11:47 AM
Hmmm. What is the value of apiBasePath?
k

KitsuneKenshi

04/30/2022, 12:05 PM
/api/auth
r

rp

04/30/2022, 12:06 PM
Hmm. That’s really odd then
Cause the refresh api and method r correct
Are you setting the apiGateway path config as well?
Can I see the debug logs when the app starts?
Hmm. The issue could be cause u r giving h3 as a framework. We don’t support that
k

KitsuneKenshi

04/30/2022, 12:10 PM
Well that's what nuxt3 is using and I'm trying to create h3 integration to SuperTokens
r

rp

04/30/2022, 12:11 PM
Hmmm
Ur source code is open source right?
k

KitsuneKenshi

04/30/2022, 12:11 PM
ye
r

rp

04/30/2022, 12:11 PM
If you open an issue about this, I can have a look
And help Debig the code
k

KitsuneKenshi

04/30/2022, 12:13 PM
eee... it started but retuns 404
r

rp

04/30/2022, 12:13 PM
So it is handling the request now
k

KitsuneKenshi

04/30/2022, 12:13 PM
ye
but still returns 404
r

rp

04/30/2022, 12:14 PM
Are you correctly setting the status code based on the result of the middleware?
k

KitsuneKenshi

04/30/2022, 12:14 PM
you're using .setStatusCode() function to set the code in error handler right?
r

rp

04/30/2022, 12:15 PM
Yes. And also send json response. And sometimes we even set it to 401
k

KitsuneKenshi

04/30/2022, 12:27 PM
It gets even weirder, cuz it does set it to 401 but it doesn't return 401..
r

rp

04/30/2022, 12:28 PM
Hmmm. Well. I’ll have a look at the code in the coming days
k

KitsuneKenshi

04/30/2022, 12:36 PM
h3 have weird typing, and that's what causes it to be hard to make
Idk if it's just a typescript bug or what, but types for H3 are broken af
this is definition of type, but when I want to use it I only get event, res and req as valid options
r

rp

04/30/2022, 4:04 PM
Hmmmm I’ll have a look soon
k

KitsuneKenshi

04/30/2022, 4:28 PM
Alright
I've messaged one of h3 authors about it, so We have to wait for answer and keep trying to figure it out
I've managed to fix it
Alr. For now refreshing and logging in works
now checking session left
Got it
everything works now
from basic functions
like getSession() createNewSession() etc
but it's impossible to use verifySession() as it is rn
How do you handle returning 401 in verify session?
well
it works
but it's weird
using it like this:
router.use("<path>", verifySession())
doesn't work but using it like this:
app.use("<path>", verifySession())
works just fine
in theory it's the same
wait
no
sorry it's not the same
but still
it's going to be weird to set it up
If you want to check it out I have uploaded the latest changes to my repo
Hey, @rp would it be a problem for you to list all functions available to the user that uses request or response? It would help me in testing everything
As i went through docs I think I've made all framework related functions. So it should work. Now just need to build it using build-pretty, and write some tests
nvm, I think I'll have to leave tests to you cuz I cannot run them for some reason
I've made PR for the changes feel free to review it