hi guys, can anyone tell me how to use super token...
# general
a
hi guys, can anyone tell me how to use super token with apollo-server?
r
hey @aditya._.tomar
You can checkout the graphql section in the docs.
a
yes i've gone throught it.. but it's not much helping me..
r
so if you have specific questions, it would be easier to help out.
a
this is the code i've written in backend.
r
alright.
that seems about right. Where are your resolvers?
and what happens when you make a request to the graphql endpoint?
a
first thing is should i've to use both apollo-server-express and express-graphql?
r
probably not. Im not a graphql expert. But both those libs seem to be doing similar tasks.
a
one solution i think of is that.. i should create one express microservice for authentication with supertoken separete.. and other microservice with apollo.. but the problem will occur that how'll i implement the session middleware in apollo then.
r
yea.. you don't need to have separate services. You can use them together as well. As explained in the docs
a
if you have any working code. can you please share. just for reference. coz I'm really confused.
my supertoken endpoints are not working.
r
so the code you have written on the backend seem to be mostly correct. The only step you missed out on is to add the supertokens errorHandler after the graphql API endpoint. About the errors you are seeing, it seems that the node server is not running / or is not reachable when you are querying it from the frontend.
We don't yet have a graphql example app, but we have a normal express example app: https://github.com/supertokens/supertokens-auth-react/tree/master/examples/with-emailpassword
a
ok i'll try again.. will let you know shortly and if it works i'll share my code as a graphql example.. 😁 thanks for your time.
r
Thank you