init static method
void
init(- {required String apiDomain,
- String? apiBasePath,
- int sessionExpiredStatusCode = 401,
- String? sessionTokenBackendDomain,
- SuperTokensTokenTransferMethod? tokenTransferMethod,
- dynamic eventHandler(
- Eventype
)?,
- dynamic preAPIHook(
- APIAction,
- dynamic
)?,
- dynamic postAPIHook(
- APIAction,
- dynamic,
- dynamic
)?}
)
Implementation
static void init({
required String apiDomain,
String? apiBasePath,
int sessionExpiredStatusCode = 401,
String? sessionTokenBackendDomain,
SuperTokensTokenTransferMethod? tokenTransferMethod,
Function(Eventype)? eventHandler,
http.Request Function(APIAction, http.Request)? preAPIHook,
Function(APIAction, http.Request, http.Response)? postAPIHook,
}) {
if (SuperTokens.isInitCalled) {
return;
}
SuperTokens.config = NormalisedInputType.normaliseInputType(
apiDomain,
apiBasePath,
sessionExpiredStatusCode,
sessionTokenBackendDomain,
tokenTransferMethod,
eventHandler,
preAPIHook,
postAPIHook,
);
SuperTokens.refreshTokenUrl =
config.apiDomain + (config.apiBasePath ?? '') + "/session/refresh";
SuperTokens.signOutUrl =
config.apiDomain + (config.apiBasePath ?? '') + "/signout";
SuperTokens.rid = "session";
SuperTokens.isInitCalled = true;
}