https://supertokens.com/ logo
#support-questions
Title
# support-questions
l

lavenderlav

04/28/2022, 5:31 AM
How do I login manually? Using a custom login page
r

rp

04/28/2022, 5:32 AM
could you elaborate on your question? It's too vague..
l

lavenderlav

04/28/2022, 6:36 AM
Is there any method to login manually with a custom page? such as
supertokens.login(email, password)
client side, i'm not too sure of how the login flow works here in supertokens
r

rp

04/28/2022, 6:46 AM
not yet. However, you can make API calls directly to your backend. The API spec is here: https://app.swaggerhub.com/apis/supertokens/FDI
there is also a blog post that talks about how to do this for social login: https://supertokens.com/blog/adding-social-login-to-your-website-with-supertokens
l

lavenderlav

04/28/2022, 7:15 AM
I'm sorry but I dont seem to still understand
r

rp

04/28/2022, 7:16 AM
have you seen the "how supertokens works" page?
and the videos in it?
l

lavenderlav

04/28/2022, 7:16 AM
with this custom login page and when the user presses login, what should the button do to sign the user in?
r

rp

04/28/2022, 7:17 AM
it should call the sign in API specified in the swagger spec above.
l

lavenderlav

04/28/2022, 7:17 AM
so its
{{supertokensServerUri}}/signin
to login?
r

rp

04/28/2022, 7:19 AM
have you seen the architecture videos in our docs? 🙂
l

lavenderlav

04/28/2022, 7:24 AM
I still dont get it sadly
r

rp

04/28/2022, 7:29 AM
hmm.
So have you integrated our backend SDK into your API layer?
l

lavenderlav

04/28/2022, 7:30 AM
I guess so yes
I suppose its the one with
Copy code
ts
await superTokensNextWrapper(
    async (next) => {
      await middleware()(req, res, next);
    },
    req,
    res
  );
  if (!res.writableEnded) {
    res.status(404).send("Not found");
  }
r

rp

04/28/2022, 7:34 AM
ok great. Are you calling supertokens.init with a backend config?
l

lavenderlav

04/28/2022, 7:34 AM
yup!
r

rp

04/28/2022, 7:35 AM
can i see the config for it?
what is the value of appInfo?
l

lavenderlav

04/28/2022, 7:37 AM
serverAddress is
localhost:3000
r

rp

04/28/2022, 7:38 AM
ok. So, from your frontend, you should query
http://localhost:3000/api/auth/signin
POST with the appropriate JSON body (see swagger spec above > emailpassword section)
and make sure you have followed the "reactjs" setup in the quick setup -> frontend section
l

lavenderlav

04/28/2022, 7:38 AM
is there a doc for that? swagger is a pain in the eye
r

rp

04/28/2022, 7:39 AM
no other docs.. just swagger
l

lavenderlav

04/28/2022, 7:39 AM
alright
thank you^^
It says
not found
Copy code
ts
await NextCors(req, res, {
    methods: ["GET", "HEAD", "PUT", "PATCH", "POST", "DELETE"],
    origin: serverAddress,
    credentials: true,
    allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
  });

  await superTokensNextWrapper(
    async (next) => {
      await middleware()(req, res, next);
    },
    req,
    res
  );
  if (!res.writableEnded) {
    res.status(404).send("Not found");
  }
r

rp

04/28/2022, 10:19 AM
Can you enable debug logging and then query it again? What are the logs?
l

lavenderlav

04/28/2022, 10:20 AM
How do I enable debug logging?
r

rp

04/28/2022, 10:21 AM
there is a troubleshooting section in the docs
l

lavenderlav

04/28/2022, 10:23 AM
Copy code
ts
  com.supertokens {t: "2022-04-28T10:21:46.241Z", message: "session init: sessionExpiredStatusCode: 401", file: "/Users/farrelldjohan/Documents/SpaceXLiquid/Playground/NextJS/pishelo/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:171:18" sdkVer: "9.2.0"} +0ms

  com.supertokens {t: "2022-04-28T10:21:46.255Z", message: "middleware: Started", file: "/Users/farrelldjohan/Documents/SpaceXLiquid/Playground/NextJS/pishelo/node_modules/supertokens-node/lib/build/supertokens.js:158:26" sdkVer: "9.2.0"} +0ms

  com.supertokens {t: "2022-04-28T10:21:46.256Z", message: "middleware: requestRID is: undefined", file: "/Users/farrelldjohan/Documents/SpaceXLiquid/Playground/NextJS/pishelo/node_modules/supertokens-node/lib/build/supertokens.js:172:26" sdkVer: "9.2.0"} +0ms

  com.supertokens {t: "2022-04-28T10:21:46.256Z", message: "middleware: Checking recipe ID for match: emailpassword", file: "/Users/farrelldjohan/Documents/SpaceXLiquid/Playground/NextJS/pishelo/node_modules/supertokens-node/lib/build/supertokens.js:220:34" sdkVer: "9.2.0"} +0ms

  com.supertokens {t: "2022-04-28T10:21:46.257Z", message: "middleware: Checking recipe ID for match: session", file: "/Users/farrelldjohan/Documents/SpaceXLiquid/Playground/NextJS/pishelo/node_modules/supertokens-node/lib/build/supertokens.js:220:34" sdkVer: "9.2.0"} +0ms

  com.supertokens {t: "2022-04-28T10:21:46.257Z", message: "middleware: Not handling because no recipe matched", file: "/Users/farrelldjohan/Documents/SpaceXLiquid/Playground/NextJS/pishelo/node_modules/supertokens-node/lib/build/supertokens.js:243:30" sdkVer: "9.2.0"} +0ms
r

rp

04/28/2022, 10:30 AM
the swagger spec says its a POST API
but you are sending a GET request
thats why not found
l

lavenderlav

04/28/2022, 10:31 AM
Ahhh alright my bad
sorry
11 Views