backend server graphql used, i am using graphql ...
# support-questions
p
backend server graphql used, i am using graphql but i think i am going wrong somewhere
r
hey @productdevbook
you set the apiBasePath to graphql?
p
Copy code
appInfo: {
      // learn more about this on https://supertokens.com/docs/session/appinfo
      appName: 'aaa',
      apiDomain: 'http://localhost:3001',
      websiteDomain: 'http://localhost:3000',
      apiBasePath: '/graphql',
      websiteBasePath: '/auth',
    },
r
right. That's why the signup, sign in APIs have
/graphql
as a prefix
set it back to
/auth
so the APIs exposed by supertokens backend SDK will be on
/auth/signin
for example
and your graphql endpoints will be on
/graphql
p
hmm okay fasfity router add ? '`auth/`
r
yea just follow the guide
p
this is finish :/
see dont fastify router add 'auth'
r
our
plugin
does that does automatically
you don't need to add the auth APIs yourself in fastify
p
iam add dashboard recipeList
Copy code
{
  "message": "Route GET:/auth/dashboard not found",
  "error": "Not Found",
  "statusCode": 404
}
r
can you enable backend debug logs and show the output?
when u call that route
p
Copy code
ts
  appInfo: {
      appName: 'aaa',
      apiDomain: 'http://localhost:3001',
      websiteDomain: 'http://localhost:3000',
      apiBasePath: '/auth',
      websiteBasePath: '/auth',
    },
thats true
r
> can you enable backend debug logs and show the output? please do this
p
Copy code
shell
[17:17:58] INFO: Route GET:/auth/dashboard not found
    reqId: "req-8"
r
no i mean we have specific supertokens logs
p
Copy code
ts
com.supertokens {t: "2022-12-11T17:19:40.137Z", message: "Started SuperTokens with debug logging (supertokens.init called)", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/supertokens.js:337:18" sdkVer: "12.1.2"} +0ms

  com.supertokens {t: "2022-12-11T17:19:40.140Z", message: "appInfo: {"appName":"aaa","apiDomain":"http://localhost:3001","websiteDomain":"http://localhost:3000","apiBasePath":"/auth","websiteBasePath":"/auth"}", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/supertokens.js:338:18" sdkVer: "12.1.2"} +0ms

  com.supertokens {t: "2022-12-11T17:19:40.143Z", message: "framework: fastify", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/supertokens.js:340:18" sdkVer: "12.1.2"} +0ms
Copy code
ts
  com.supertokens {t: "2022-12-11T17:19:40.148Z", message: "session init: antiCsrf: NONE", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:199:18" sdkVer: "12.1.2"} +0ms

  com.supertokens {t: "2022-12-11T17:19:40.151Z", message: "session init: cookieDomain: undefined", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:200:18" sdkVer: "12.1.2"} +0ms

  com.supertokens {t: "2022-12-11T17:19:40.153Z", message: "session init: cookieSameSite: lax", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:201:18" sdkVer: "12.1.2"} +0ms

  com.supertokens {t: "2022-12-11T17:19:40.155Z", message: "session init: cookieSecure: false", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:202:18" sdkVer: "12.1.2"} +0ms

  com.supertokens {t: "2022-12-11T17:19:40.157Z", message: "session init: refreshTokenPath: /auth/session/refresh", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:203:18" sdkVer: "12.1.2"} +0ms

  com.supertokens {t: "2022-12-11T17:19:40.161Z", message: "session init: sessionExpiredStatusCode: 401", file: "/home/productdevbook/Documents/aaa/server-micro-library/node_modules/.pnpm/supertokens-node@12.1.2/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:206:18" sdkVer: "12.1.2"} +0ms
r
ok and what is the output when you load the dashboard on the browser?
i mean in the logs
p
docker ?
r
no the backend SDK logs
like the ones you posted before
p
Copy code
[17:23:24] INFO: Route GET:/auth/dashboard not found
    reqId: "req-5"
r
it seems like the middleware is not being applied
did you add these two lines in your code?
Copy code
await fastify.register(formDataPlugin);
    await fastify.register(plugin);
p
this problem my code
delete and fixed :/
r
so it works now?
p
yes
Thank you
r
nice
p
🔥
api key -> thats true ?
Copy code
ts
[17:29:00] INFO: Body cannot be empty when content-type is set to 'application/json'
    reqId: "req-2"
    res: {
      "statusCode": 400
    }
    err: {
      "type": "FastifyError",
      "message": "Body cannot be empty when content-type is set to 'application/json'",
      "stack":
          FastifyError: Body cannot be empty when content-type is set to 'application/json'
              at Parser.defaultJsonParser (/home/productdevbook/Documents/aa/server-micro-library/node_modules/.pnpm/fastify@4.10.2/node_modules/fastify/lib/contentTypeParser.js:281:19)
              at IncomingMessage.onEnd (/home/productdevbook/Documents/aa/server-micro-library/node_modules/.pnpm/fastify@4.10.2/node_modules/fastify/lib/contentTypeParser.js:269:27)
              at IncomingMessage.emit (node:events:513:28)
              at IncomingMessage.emit (node:domain:489:12)
              at endReadableNT (node:internal/streams/readable:1359:12)
              at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
      "name": "FastifyError",
      "code": "FST_ERR_CTP_EMPTY_JSON_BODY",
      "statusCode": 400
r
when you init the dashboard recipe, you need to provide an API there. The same key goes in the dashboard on the frontend
yea. This is a known bug. We are fixing it sometime tomorroew.
p
vue login register working !!!
backend add
Copy code
Session.init({
        jwt: {
          enable: true,
          issuer: 'http://localhost:3001/auth',
          propertyNameInAccessTokenPayload: 'session',
        },
      }),
jwt enable but dont login jwt response
Copy code
{
  "status": "OK",
  "user": {
    "email": "testa@test.com",
    "id": "9fbb9760-0972-4267-b097-c0a243d08a17",
    "timeJoined": 1670780350018
  }
}
hmm cookie auto add, but how to response all data ?
https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/sessions/with-jwt/read-jwt I guess it is brought in this way. I thought it would normally come right after login