12/08/2022 | News release | Distributed by Public on 12/08/2022 09:12
This article was co-authored by Advait Ruia, CEO at SuperTokens.
Authentication directly affects the UX, dev experience, and security of any app. Authentication solutions ensure that sensitive user data is protected and only owners of this data have access to it. Although authentication is a vital part of web services, building it correctly can be time-consuming and expensive. For a personal project, a simple email/password solution can be built in a day, but the security and reliability requirements of production-ready applications add additional complexities.
While there are a lot of resources available online, it takes time to go through all the content for every aspect of authentication (and even if you do, you may miss important information). And it takes even more effort to make sure your application is up to date with security best practices. If you're going to move quickly while still meeting high standards, you need a solution that has the right level of abstraction, gives you maximum control, is secure, and is simple to use - just like if you build it from scratch, but without spending the time to learn, build, and maintain it.
SuperTokens is an open-source authentication solution. It provides an end-to-end solution to easily implement the following features:
SDKs are available for all popular languages and front-end frameworks such as Node.js, React.js, Reactive Native, Vanilla JS, and more.
SuperTokens' architecture is optimized to add secure authentication for your users without compromising on user and developer experience. It consists of three building blocks:
To learn more about the SuperTokens architecture, watch this video
Here are some features that set SuperTokens apart from other user-authentication solutions:
Docker Extensions help you build and integrate software applications into your daily workflows. With the SuperTokens extension, you get a simple way to quickly deploy Supertokens.
Once the extension is installed and started, you'll have a running Supertokens core application. The extension allows you to connect to your preferred database, set the environment variable, and get your core connected to your backend.
The SuperTokens extension speeds up the process of getting started with SuperTokens and, over time, we hope to make it the best place to manage the SuperTokens core.
Your first step is picking the authentication strategy, or recipe, you want to implement in your applications:
You can find user guides for all supported recipes here.
After picking your recipe, you can start integrating the SuperTokens frontend and backend SDKs into your tech stack.
For example, if you want both email password and social authentication methods in your application, you can use this guide to initialize SuperTokens in your frontend and backend.
The final step is setting up the SuperTokens core. SuperTokens offers a managed service to get started quickly, but today we're going to take a look at how you can self-host and manage the SuperTokens core using the SuperTokens Docker extension.
Prerequisites:Docker Desktop 4.8 or later
Hop into Docker Desktop and confirm that the Docker Extensions feature is enabled. Go to Settings > Extensions > and check the "Enable Docker Extensions" box.
Run this command to clone the extension:
git clone [email protected]:supertokens/supertokens-docker-extension.git
Build the extension:
make build-extension
Add the extension to Docker Desktop:
docker extension install supertokens/supertokens-docker-extension:latest
Once the extension is added to Docker Desktop, you can run the SuperTokens core.
SuperTokens currently supports MySQL and PostgreSQL. Choose which Docker image to load.
You'll need to create a database SuperTokens can write to. Follow this guide to see how to do this. If you don't provide a connection URI, SuperTokens will run with an in-memory database.
In addition to the connection URI, you can add environment variables to the Docker container to customize the core.
Select "Start docker container" to start the SuperTokens core. This will start the SuperTokens core on port 3567. You can ping "https://localhost:3567" to check if the core is running successfully.
(Note: This example code snippet is for Node.js, but if you're using Python or Golang, a similar change should be made. You can find the guide on how to do that here.)
Now that you've set up your core and connected it to your backend, your application should be up and ready to authenticate users!
To learn more about SuperTokens, you can visit our website or join our Discord community.
We're committed to making SuperTokens a more powerful user-authentication solution for our developers and users - and we need help! We're actively looking for active contributors to the SuperTokens Docker extension project. The current code is simple and easy to get started with. And we're always around to give potential contributors a hand.
If you like SuperTokens, you can help us spread the word by adding a star to the repo.