First time trying out ST, really just looking for inexpensive/simple auth. Currently I have an API i...
u
First time trying out ST, really just looking for inexpensive/simple auth. Currently I have an API in python (using Sanic framework) and I want to add some security so I can start having beta users try it out. There is no frontend at the moment so I really just need to get a username/password in headers and return a token that can be used after that to authenticate. Is this a supported use case? I have been browsing the recipes and they mostly seem geared around FE and BE working together.
r
Hey!
If there is no frontend, how will the users use the app?
u
programmatically. For example, user sends a post request to /auth with a username and password in the headers and is returned an access token that can then be passed to other api endpoints and validated using a middleware.
r
I see. So this is possible. Just follow the backend setup instructions
That will expose the APIs that the user can call
You may also want to override the session recipe to just issue a JWT instead of access / refresh token if you want to keep things simple for the user (otherwise they will have to read from and set cookies and take care of refreshing)
That’s an example of how you can customise the session recipe to issue a simple JWT instead of access / refresh tokens in cookies
u
Okay that makes sense so far. 👍 For signing up new users, would I need to do that in the web console? Or how do I add them?
Also, I am using the Sanic framework for python, not sure if you are familiar. The python examples are all for other frameworks, is there a vanilla python example I could adapt? I'm actually considering changing the framework bc I've found a few other pain points where other tools don't integrate as well as I want.
r
We fully support django, flask and fastapi. If you want to use another framework, you will have to make APIs yourself in that framework which call the functions from our SDK
For example, we have a sign_up and sign_in function which you can call in your APIs which the frontend calls
In this case, the example I sent above is not really applicable since that assumes you are integrating with one of the frameworks that we do fully support
4 Views