Is there a way to authenticate programaticaly. I'm...
# support-questions
Is there a way to authenticate programaticaly. I'm using the Email Password and Session recipe. I want to authenticate on so that i can have a playground for my developers. My initial thoughts were to use
to save valid auth tokens as cookies on the graphql playground. The idea was to use a login mutation which sets the cookies, but i cant seem to get it to work programatically
I've been thinking of just enabling JWT. The important part is just to get Apollo studio to work. I could enable Apollo Playground so that it's on the same domain, but playground will be deprecated and therefore using apollo studio would be preferable
You could use a JWT to authenticate users on Apollo Studio:
Yeah I think i will go for the JWT then!
its juts that i saw that apollo studio had support for setting cookies
What part did not work for you?
Were you getting any specific errors?
I did get the user from the signIn method
but when trying to create a new session I would get an error
The signIn method worked well and i got a user out from it
But when creating a session and passing in the res object, it wouldn't work
This is the settings in apollo studio which lead me to attempt session authentication in apollo studio haha. After setting the correct settings it did lead me down a rabbithole
= If you have please follow this trouble shooting guide and post your output here (
yes, I did set it up correctly and I do get correct output when making a graphql request from the frontend
It's just when using an apollostudio
Did I use createSession correct? I was unsure how to create sessions programatically and attach them to cookies
So if you already called signIn/signUp from SuperTokens you dont need to call createSession yourself
Which methods would I need to use to attach the new session to the response/request?
I'm looking through the recipe_session documentation right now
You can use
on the frontend to help with this. It uses network interception and does session management for you
Hmm, that would be hard to implement in apollo studio
Well, might as well go for JWT then
thanks for the help :))
it was worth the attempt
So the backend SDK (that you are using) already sets the cookies
The browser should handle sending them
aaah, that makes sense
It seems difficult to set them in an external grahql playground
so JWt is probably the easiest solution
If you are successfully creating a session on Apollo Studio using SuperTokens then the part of sending cookies when making network requests should already be working