Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oxsav/fastify-firebase-auth
Fastify Firebase Auth
https://github.com/oxsav/fastify-firebase-auth
Last synced: about 2 months ago
JSON representation
Fastify Firebase Auth
- Host: GitHub
- URL: https://github.com/oxsav/fastify-firebase-auth
- Owner: oxsav
- License: mit
- Created: 2017-10-28T20:23:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-15T08:01:22.000Z (over 6 years ago)
- Last Synced: 2024-08-05T15:04:32.876Z (5 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fastify - `fastify-firebase-auth`
README
# fastify-firebase-auth
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
Fastify Firebase Auth API plugin.
Under the hood the [firebase](https://github.com/firebase/firebase-js-sdk) is used, the options that you pass to `register` will be passed to the Firebase service.## Install
```
npm i fastify-firebase-auth --save
```## Usage
Add it to you project with `register` and you are done!
This plugin will add the `auth` namespace in your Fastify instance, with the all functions in the [Firebase Auth API](https://firebase.google.com/docs/reference/js/firebase.auth.Auth):Example:
```js
const fastify = require('fastify')fastify.register(require('fastify-firebase-auth'), {
apiKey: ,
databaseURL: ,
projectId: ,
storageBucket:
})fastify.post('/signin', async (request, reply) => {
const {email, password} = request.body;
const response = await fastify.auth.signInWithEmailAndPassword(email, password);
return response;
});fastify.listen(3000, err => {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})
```## License
Licensed under [MIT](./LICENSE).