Backend SDK core interceptor
Overview
This hook intercepts all outgoing requests from the backend SDK to the core. Capture and modify the request before sending it to the core. Users can modify the HTTP method, query params, headers, and body of the request.
Prerequisites
Important
This feature is only available for SDKs versions:
- NodeJS >=
v16.5.0
- Python >=
v0.16.8
- GoLang >=
v0.6.6
Example
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: [
// ...
],
});