This SDK documentation is outdated. Please do not refer to it, and instead visit the User Guides section.

Skip to main content
Version: 8.2.X

Submitting form data

Traditionally, when submitting form data, the browser makes an API call for you to submit the data.

With SuperTokens, you will have to make this API call yourself so that correct session interception is added.

<html>
<body>

<form onsubmit="return submitData()">
Enter name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>

<script>
supertokens.init(/* params.. */); // initialise SuperTokens
</script>

<script>
function submitData() {
// extract element out of the user input field and call API using fetch or axios

return false; // will prevent any redirection that happens when a form is submitted.
}
</script>

</body>
</html>
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI