# re-authenticate

> Authentication for MongoDB and React

Latest version **1.0.7** (published 2023-09-12) · none license · 0 weekly downloads

## Install

```sh
npm install re-authenticate
pnpm add re-authenticate
yarn add re-authenticate
bun add re-authenticate
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-09-12 |
| First published | 2023-08-04 |
| Weekly downloads | 0 |
| License | none |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 574.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | kaipereira |
| Maintainers | kaipereira |

## Links

- npm: https://www.npmjs.com/package/re-authenticate
- Repository: re-auth
- npm.io page: https://npm.io/package/re-authenticate

## Recent versions

- 1.0.7 (latest) — 2023-09-12
- 1.0.6 — 2023-09-11
- 1.0.5 — 2023-09-03
- 1.0.4 — 2023-08-30
- 1.0.3 — 2023-08-30
- 1.0.2 — 2023-08-30
- 1.0.1 — 2023-08-29
- 0.0.1 — 2023-08-24
- 1.0.0 — 2023-08-04

## README

# `Re-Auth`

Re-Auth is a React library and platform for implementing MongoDB authentication into your application.

The Re-Auth package is extremely simple to use a setup for both React and NextJS!

## Usage

### Installation

```js
npm i re-authenticate
```

### Wrap and configure the provider

To use the re-authenticate package, all you have to do is declare, configure and wrap your app root in it!

```js
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { AuthProvider } from "re-authenticate"

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <AuthProvider
      apiKey="your_api_key_from_re-auth.com"
    >
      <App />
    </AuthProvider>
  </React.StrictMode>
);
```

## Functions

### React hook

After configuring the application you get access to a react hook with all of the auth functions:

```js
import { useAuth } from "re-authenticate";

function App() {
  const { 
    loginUserWithEmailPassword, 
    registerUserWithEmailPassword,
    logoutUser, 
    getUserDetails 
  } = useAuth()

  return (
    <>
      
    </>
  );
}

export default App;
```

### Hook functions

| Function | Description | Type |
| ----- | ----- | ----- |
| loginUserWithEmailPassword | Login in a user that's already in your database using email/password | (email: string, password: string) |
| registerUserWithEmailPassword | Register a new user into your database using email/password | (email: string, password: string) |
| logoutUser | Log out a user that is currently logged in | None |
| getUserDetails | Get the details of a user that is currently in your database | None

---
_Source: https://npm.io/package/re-authenticate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
