Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@stanlemon/react-couchdb-authentication
Advanced tools
React component for authenticating against a CouchDB user db and syncing it locally with PouchDB.
React component for streamlining user authentication against an Apache CouchDB instance. If you're building a React application and want to let the amazing CouchDB be your backend, you can take advantage of CouchDB's userdb feature, and with this component streamline using CouchDB to sign up and login users to a secure application. Each user's database is replicated locally to a PouchDB instance that you can use to wrok with documents.
First add the component to your application. You should also have React and PouchDB installed.
npm install --save @stanlemon/react-couchdb-authentication pouchdb react
You will need an instance of CouchDB. If you don't have one, the CouchDB install docs will take care of you.
In your CouchDB config you will need to enable couch_user.enable
and couch_user.delete_dbs
. You can do this through Fauxton, CouchDB's excellent UI or with the following commands:
curl -X PUT localhost:5984/_node/_local/_config/couch_peruser/enable -d "\"true\""
curl -X PUT localhost:5984/_node/_local/_config/couch_peruser/delete_dbs -d "\"true\""
Enabling these settings ensures that once a user signs up, their dedicated database is setup (and vice versa when their user is deleted).
The <Authentication/>
component is easy to use, simply wrap your <App />
and use the provided <Login />
and <SignUp />
components to get going. You can customize your login and signup views later.
<Authentication
url="http://localhost:5984"
login={<Login />}
signup={<SignUp />}
/>
<h1>Authenticated!</h1>
</Authentication>
Want an easier way to see this in action? Clone the repository, and checkout the example folder. You can run npm start
inside of it and see a fully functioning implementation of the components.
The <Login />
and <SignUp />
components are actually containers that provide some simple setters that are supplied to a view via the component
property, which you can customize to look appropriate for your application.
Most issues are due to CouchDB being misconfigured, or cookies already being set. If you've pulled up Fauxton in your browser you will want to clear the cookies for your CouchDB instance before using this component.
This component has a fair amount of logging that can give you better insight into it's behavior. To see that logging you can set debug={true}
on the <Authentication/>
component and everything will be logged out to the console. Do not do this in production!
To get started, you can build the components using Typescript by simply doing:
npm install
npm run build
You can lint the source by doing:
npm run lint
You can run tests by doing:
npm test
Tests require a working CouchDB instance. You can checkout the tests on TravisCI.
FAQs
React component for authenticating against a CouchDB user db and syncing it locally with PouchDB.
The npm package @stanlemon/react-couchdb-authentication receives a total of 38 weekly downloads. As such, @stanlemon/react-couchdb-authentication popularity was classified as not popular.
We found that @stanlemon/react-couchdb-authentication demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.