fastify-authing
v1.0.1
Published
[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.png?v=101)](https://github.com/ellerbrock/typescript-badges/) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
Downloads
2
Readme
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: '[email protected]',
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();