Skip to main content

Backend SDK Core Interceptor

important

This feature is only available for SDKs versions:

  • NodeJS >= v16.5.0
  • Python >= v0.16.8
  • GoLang >= v0.6.6

This hook can be used to intercept all outgoing requests from the backend SDK to the core. The request can be captured and modified before it is sent to the core.

Users can modify the HTTP method, query params, headers and body of the request.

Example Use#

import { HttpRequest } from "supertokens-node/types";
import SuperTokens from "supertokens-node";

SuperTokens.init({
supertokens: {
connectionURI: "...",
apiKey: "...",
networkInterceptor: (request: HttpRequest, userContext: any) => {
console.log("http request to core: ", request)
// this can also be used to return a modified request object.
return request;
},
},
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "...",
},
recipeList: [
// ...
],
});
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI