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

Skip to main content
Version: 8.1.X

Sending Requests with Axios

Step 1) Add axios interceptors#

import SuperTokens from 'supertokens-website';


To be called on each axios instances that is being imported.

Step 2) Use axios as usual#

import SuperTokens from 'supertokens-website';
import axios from "axios";

apiDomain: ""

async function doAPICalls() {
try {
let postData = { ... };
let response = await axios({url: "someAPI", method: "post", data: postData });
let data = await;
let someField = data.someField;
} catch (err) {
if (err.response !== undefined && err.response.status === 401) {
// redirect user to login
} else {
// handle error
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI