Disabling APIs
- NodeJS
- GoLang
- Python
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 refresh session api from this recipe, all you do is this:
import SuperTokens from "supertokens-node";
import Session from "supertokens-node/recipe/session";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
Session.init({
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,
refreshPOST: 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 refresh session api from this recipe, all you do is this:
import (
"github.com/supertokens/supertokens-golang/recipe/session"
"github.com/supertokens/supertokens-golang/recipe/session/sessmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
session.Init(&sessmodels.TypeInput{
Override: &sessmodels.OverrideStruct{
APIs: func(originalImplementation sessmodels.APIInterface) sessmodels.APIInterface {
// Disable the refresh API
originalImplementation.RefreshPOST = 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 refresh session api from this recipe, all you do is this:
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import session
from supertokens_python.recipe.session.interfaces import APIInterface
def apis_override(original_impl: APIInterface):
original_impl.disable_refresh_post = True
return original_impl
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
session.init(
override=session.InputOverrideConfig(
apis=apis_override
)
)
]
)
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