https://supertokens.com/ logo
auth routes missing
u

unpleasant

04/05/2023, 3:04 PM
when setting up the supertokens backend it doesnt generate the /auth/... routes, therefore i cant signup or login... here is my backend code :
js
import express from "express";
import cors from "cors";
import supertokens from "supertokens-node";
import { verifySession } from "supertokens-node/recipe/session/framework/express";
import { middleware, errorHandler, SessionRequest } from "supertokens-node/framework/express";
import { getWebsiteDomain, SuperTokensConfig } from "./config";

supertokens.init(SuperTokensConfig);

const app = express();

app.use(
    cors({
        origin: getWebsiteDomain(),
        //allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
        methods: ["GET", "PUT", "POST", "DELETE"],
        credentials: true,
    })
);

// This exposes all the APIs from SuperTokens to the client.
app.use(middleware());

// An example API that requires session verification
app.get("/sessioninfo", verifySession(), async (req: SessionRequest, res) => {
    let session = req.session;
    res.send({
        sessionHandle: session!.getHandle(),
        userId: session!.getUserId(),
        accessTokenPayload: session!.getAccessTokenPayload(),
    });
});

// In case of session related errors, this error handler
// returns 401 to the client.
app.use(errorHandler());

app.listen(3001, () => console.log(`API Server listening on port 3001`));
r

rp

04/05/2023, 3:07 PM
hey @unpleasant what's the
SuperTokensConfig
value?
r

rp

04/05/2023, 3:15 PM
and how are you querying the API?
500 means that it was found, but some other issue occurred.
whats the stack trace / error message?
u

unpleasant

04/05/2023, 3:37 PM
and also for POST

https://cdn.discordapp.com/attachments/1093189472922898596/1093197644484059267/image.png

r

rp

04/05/2023, 3:46 PM
no i mean on the backend sizde
add your own error handler and log it in there
u

unpleasant

04/07/2023, 1:21 PM
this is when i write in the email and it checks if it already exists
i am using this supertokens core version : https://github.com/supertokens/supertokens-docker-mongodb
r

rp

04/07/2023, 2:07 PM
So mongodb plugin doesn't support the login methods. It only supports session management. So please switch to using mysql / postgresql or using our managed service.