Disabling APIs
- 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.
To disable an API entirely, all you need to do is override the api implementation with undefined
.
For example, if you want to disable the sign-in-up api from this recipe, all you do is this:
import SuperTokens from "supertokens-node";
import ThirdParty from "supertokens-node/recipe/thirdparty";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdParty.init({
signInAndUpFeature: {
providers: [/* ... */]
},
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,
signInUpPOST: undefined
}
}
}
})
]
});
To disable an API entirely, all you need to do is override the api implementation with nil
.
For example, if you want to disable the sign-up / sign-in api from this recipe, all you do is this:
import (
"github.com/supertokens/supertokens-golang/recipe/thirdparty"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdparty.Init(&tpmodels.TypeInput{
Override: &tpmodels.OverrideStruct{
APIs: func(originalImplementation tpmodels.APIInterface) tpmodels.APIInterface {
// we set the sign in / up API to nil to disable it
originalImplementation.SignInUpPOST = nil
return originalImplementation
},
},
}),
},
})
}
To disable an API entirely, all you need to do is override the api disable bool value to True
.
For example, if you want to disable the sign-up / sign-in api from this recipe, all you do is this:
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdparty
from supertokens_python.recipe.thirdparty.interfaces import APIInterface
def apis_override(original_impl: APIInterface):
original_impl.disable_sign_in_up_post = True
return original_impl
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdparty.init(
override=thirdparty.InputOverrideConfig(
apis=apis_override
),
sign_in_and_up_feature=thirdparty.SignInAndUpFeature(providers=[
# ...
])
)
]
)
important
You then need to define your own routes that will handle this API call. You can see the Frontend driver interface API spec here