Hi team! I have just finished implementing SuperTo...
# support-questions
n
Hi team! I have just finished implementing SuperTokens into my NestJS BE. I have some APIs that I'm trying to protect with "@UseGuards(AuthGuard)". I'm trying to test these protected endpoints with Postman, but have no idea how. Can someone help me? Thanks in advance!
r
Which recipe are you using?
n
r
Ah right. So your only using session management?
n
Yep
n
I'm only using this as I won't be using a login form for my web app (I'll be authenticating users with google login)
r
Right. We have a recipe for social login + sessions as well
Which provides sign in with google
So you might wanna check that out too
n
Can I skip the social login part? I want people to be redirected to Google signin the moment they enter my web app (it's an internal project)
r
Yea. Of course. You can implement that on your own and use supertoeks just for sessions
n
So, to sum up, I need to create a new user session to call the API endpoints from postman?
r
Well. You need to create some API on your backend that creates a new session. Usually this would be the login API. In your case the api that consumes the code sent by google
And even with our third party recipe, you can implement it such that the user is directly taken to google if they are not signed in.
n
So, my understanding is, the flow would be something like: User auth-ing with google -> google returns a code -> I use that code to create a new user session -> users can call my backend APIs?
r
Yea. Exactly!
Also keep on mind that you must provide the redirect url to google to point to your frontend app. Your frontend app should then send the code to the backend.
That’s needed cause if google calls your backend directly, then some of the session tokens will not be saved on your frontend app and it won’t work
n
That's great! Thank you so much for the help!
3 Views