Skip to main content

Making Requests

info

SuperTokens uses cookies for session verification. This means that no additional token required when making requests

Using fetch#

SuperTokens adds request and response interceptors for fetch automatically, this is also applicable for any GraphQL clients that use fetch internally (for example Apollo). No additional steps are required.

Using axios#

important

You must call addAxiosInterceptors on all axios imports.

import axios from "axios";import Session from "supertokens-auth-react/recipe/session";Session.addAxiosInterceptors(axios);
async function callAPI() {    // use axios as you normally do    let response = await axios.get(...);}