Fullstack authentication and accounts-management for GraphQL and REST
Copyright (c) 2016 by Gadi Cohen & Tim Mikeladze. Released under the MIT license.
This package, along with the rest of the packages under the js-accounts
organization are under active development and are not ready for consumption.
Install the core package.
npm i -S @accounts/server
Next install the package based on the the type of transport and the web framework you are using. We support GraphQL and REST for the transport and Express.
npm i -S @accounts/rest-express
Finally you'll need a data store adapter. We support the following data stores.
npm i -S @accounts/mongo
npm i -S @accounts/redis
npm i -S @accounts/sql
You can find a working example here.
Configuration:
AccountsServer.config({
siteUrl: 'https://my-app.com',
email: // a valid email config object passed to emailjs
// https://github.com/eleith/emailjs#example-usage---text-only-emails
// You can handle the send of the emails by providing an optional sendMail function
// sendMail: ({ from, to, text, html }): Promise<void>
});
To overwrite the email templates:
AccountsServer.emailTemplates.from = 'my-app <no-reply@my-app.com>';
AccountsServer.emailTemplates.verifyEmail.subject = (user) => `Verify your account email ${user.profile.lastname}`;
AccountsServer.emailTemplates.verifyEmail.text = (user, url) => `To verify your account email please click on this link: ${url}`;