Did anybody manage to make the dashboard run with ...
# support-questions
r
Did anybody manage to make the dashboard run with nextjs?
n
Hi can I see the backend config
r
Sure:
Copy code
import SessionNode from 'supertokens-node/recipe/session'
import EmailPasswordNode, { getUserById } from 'supertokens-node/recipe/emailpassword'
import { appInfo } from './appInfo'
import { TypeInput } from 'supertokens-node/types'
import DashboardNode from 'supertokens-node/recipe/dashboard'

export const backendConfig = (): TypeInput => {
  const apiKey = 'xxxxxxx'
  return {
    framework: 'express',
    supertokens: {
      // These are the connection details of the app you created on supertokens.com
      connectionURI: 'https://dev-7083ba917d4511edb03b1f2e451c3d8c-eu-west-1.aws.supertokens.io:3568',
      apiKey,
    },
    appInfo,
    recipeList: [
      EmailPasswordNode.init(),
      SessionNode.init({
        override: {
          functions: (originalImplementation) => {
            return {
              ...originalImplementation,
              createNewSession: async (input) => {
                let userId = input.userId
                const user = await getUserById(userId)
                // This goes in the access token, and is availble to read on the frontend.
                input.accessTokenPayload = { ...input.accessTokenPayload, email: user?.email }
                return originalImplementation.createNewSession(input)
              },
            }
          },
        },
      }),
      DashboardNode.init({ apiKey: 'random' }),
    ],
    isInServerlessEnv: true,
  }
}
n
And what URL are you using to access the dashboard?
r
n
The dashboard is hosted from the API layer and not the frontend, so if you are using NextJS functions the URL should be localhost:3000/api/auth/dashboard
AWSOME!
n
xD
Happy to help
r
Sorry for bothering you
Didn't think of that one.
n
No problem at all, feel free to reach out if you have any issues
2 Views