1.0.1 • Published 5 years ago
fastify-authing v1.0.1
fastify-authing
Authing plugin for fastify
Usage
$ npm install fastify-authing --save
import * as Fastify from 'fastify';
import fastifyAuthing from 'fastify-authing';
const fastify = Fastify({
logger: true
});
fastify.register(fastifyAuthing, {
clientId: 'your_client_id',
secret: 'your_app_secret'
});
fastify.get('/', async (request, reply) => {
// @ts-ignore
const user = await fastify.authing.login({
email: 'test@testmail.com',
password: 'testpassword'
});
return user;
});
const start = async () => {
try {
const address = await fastify.listen(3000);
fastify.log.info(`server listening on ${address}`)
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
};
start();