Hello, I am planning to use SuperTokens as a self-...
# support-questions
n
Hello, I am planning to use SuperTokens as a self-hosted auth service. I have successfully done the docker setup connected with the DB, but I am wondering for the back-end, I see there are libraries for Node, GoLang, and python, but is there a library for Rust? If not, how can I make Rust be able to communicate with SuperTokens?
r
hey @Noobster123
We do not yet have a Rust SDK, so you will have two options on how you can use SuperTokens: 1) Query the SuperTokens core via your Rust backend via http API calls. This way, you can make your own sign in / sign up etc routes which the frontend can call, and in turn these routes will call the core. The API spec for the core is: https://app.swaggerhub.com/apis/supertokens/CDI. 2) Spin up an auth server in nodejs, python or Golang and use our backend SDK in them. The frontend would query these processes for auth related operations and in turn would receive a JWT which you can sent to your Rust backend. Your Tust backend would in turn [verify the JWT](https://supertokens.com/docs/session/common-customizations/sessions/with-jwt/jwt-verification) and create it's own session to talk to the frontend. I would recommend the (2) approach as it's lesser work.
n
Ah okay, so option 2 meaning I would have another server in node, python, or golang in another port, and front end will call an endpoint in Rust which would proxy the request to the auth server? and any APIs in Rust that would need auth would just need to verify the JWT?
r
Mostly yes. The frontend doesn't need to call rust which proxies the request. The frontend can directly call the node / python / golang server
But i mean, you could surely do the proxying thing if you like
Just make sure that the node / golang / python server (let's call it auth server), is reachable by the frontend in a way that the domain is either equal to the frontend's domain, or is a sub domain of the frontend's domain.
If the frontend is example.com, and your rust server is api.example.com. So the auth server can be api.example.com/auth/*, or auth.example.com or any other path / sub domain
n
Got it, thanks rp, I think you're right that Rust doesn't need to proxy the request, just need to add the server in the nginx config
r
Yes. That would work just fine 🙂
10 Views