Which UI do you use?
Custom UI
Pre built UI
API Base Path
#
Step 1) Back End ChangeThe default apiBasePath
is /auth
. If you don't like that, or if you need to change it to make is similar to your other routes, you can do so by setting the apiBasePath
config:
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
For other backend frameworks, you can follow our guide on how to spin up a separate server configured with the SuperTokens backend SDK to authenticate requests and issue session tokens.
import SuperTokens from "supertokens-node";
SuperTokens.init({
appInfo: {
appName: "yourAppName",
apiDomain: "yourApi",
websiteDomain: "yourWebsite",
apiBasePath: "/api/v3/auth"
},
recipeList: [],
});
import "github.com/supertokens/supertokens-golang/supertokens"
func main() {
apiBasePath := "/authentication"
supertokens.Init(supertokens.TypeInput{
AppInfo: supertokens.AppInfo{
AppName: "yourAppName",
APIDomain: "yourApi",
WebsiteDomain: "yourWebsite",
APIBasePath: &apiBasePath,
},
})
}
from supertokens_python import init, InputAppInfo
init(
app_info=InputAppInfo(
app_name='yourAppName',
website_domain='yourWebsite',
api_domain='yourApi',
api_base_path='/authentication'
),
framework='...',
recipe_list=[
#...
]
)
#
Step 2) Front End ChangeYou also need to change the apiBasePath
in your frontend code:
- ReactJS
- Angular
- Vue
Important
SuperTokens does not provide non-React UI components. So we will be using the
supertokens-auth-react
SDK and will inject the React components to show the UI. Therefore, the code snippet below refers to the supertokens-auth-react
SDK.import SuperTokens from "supertokens-auth-react";
SuperTokens.init({
appInfo: {
appName: "yourAppName",
apiDomain: "yourApi",
websiteDomain: "yourWebsite",
apiBasePath: "/api/v3/auth"
},
recipeList: [],
});
Important
SuperTokens does not provide non-React UI components. So we will be using the
supertokens-auth-react
SDK and will inject the React components to show the UI. Therefore, the code snippet below refers to the supertokens-auth-react
SDK.import SuperTokens from "supertokens-auth-react";
SuperTokens.init({
appInfo: {
appName: "yourAppName",
apiDomain: "yourApi",
websiteDomain: "yourWebsite",
apiBasePath: "/api/v3/auth"
},
recipeList: [],
});
import SuperTokens from "supertokens-auth-react";
SuperTokens.init({
appInfo: {
appName: "yourAppName",
apiDomain: "yourApi",
websiteDomain: "yourWebsite",
apiBasePath: "/api/v3/auth"
},
recipeList: [],
});