oneaccount-express
This library is a middleware for Node.js express
web framework.
Please follow the instructions or official documentations for an integration.
NOTE: example 2 is the most preferred approach for a production setup
Installation
npm install -S oneaccount-express
Example 1 (In Memory Engine):
oneaccount-express
by default uses in memory cache engine if a custom engine is not supplied.
const express = const OneAccount = const app = app // The callback URL is the URL you have set when you created One account app.// The path for the router, callbackURL // and callback URL of the application must be the same.app app // OPTIONAL: in addition you can read error messages if any occuredapp app
For brevity we will leave out comments for the following examples, if something is unclear please read the comments on the first example or check the documentation or create an issue
Next 2 examples show how you can use any caching engine with oneaccount-express
this is recommended for a production environment. Both examples are used
for the same purpose the only difference is how you implement them.
We will be using ioredis
for this example: https://github.com/luin/ioredis
Example 2 (Custom Engine):
For this example we will also be using ioredis
the only difference is that
this example demonstrates how to create a custom engine
const Redis = const redis = app app
Now our authentication is production ready!
Example 3 (Custom Engine):
const Redis = app app