xesjkeee
11/22/2021, 12:25 PMtypescript
// ...
SuperTokens.init({
framework: 'fastify',
supertokens: {
connectionURI: 'http://localhost:3567'
},
appInfo: {
appName: 'SuperTokens Demo App',
apiDomain: 'http://localhost:3001',
websiteDomain: 'http://localhost:3000',
},
recipeList: [
EmailPassword.init(),
Session.init()
]
})
fastify.setErrorHandler(errorHandler())
fastify.get('/', {
preHandler: verifySession()
}, (request: FastifyRequest, reply: FastifyReply) => request.session.getUserId())
fastify.get('/auth/login', async (request: FastifyRequest, reply: FastifyReply) => {
// Here I got credentials from query for example
const {email, password} = request.query
// What's next? Which of the methods I should call?
})