\SuperTokens\SuperTokens::handleError($request, $exception, [
'onUnauthorised' => function($exception, $request, $response){/* TODO */},
'onTryRefreshToken' => function($exception, $request, $response){/* TODO */},
'onTokenTheftDetected' => function($sessionHandle, $userId, $request, $response){/* TODO */}
]);
onUnauthorised
Default behaviour: Sends session expired status code as per what is set in the config.yaml file. By default, the status code is 401
All auth cookies are cleared by the time this function is called, even if you do not use the default one.
onTryRefreshToken
Default behaviour: Sends session expired status code as per what is set in the config.yaml file. By default, the status code is 401
No auth cookies are cleared.
onTokenTheftDetected
Default behaviour: Revokes the affected session and sends session expired status code as per what is set in the config.yaml file. By default, the status code is 401.
All auth cookies are cleared by the time this function is called, even if you do not use the default one.