1.0.7 • Published 8 months ago

re-authenticate v1.0.7

Weekly downloads
-
License
none
Repository
-
Last release
8 months ago

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

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!

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:

import { useAuth } from "re-authenticate";

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

  return (
    <>
      
    </>
  );
}

export default App;

Hook functions

FunctionDescriptionType
loginUserWithEmailPasswordLogin in a user that's already in your database using email/password(email: string, password: string)
registerUserWithEmailPasswordRegister a new user into your database using email/password(email: string, password: string)
logoutUserLog out a user that is currently logged inNone
getUserDetailsGet the details of a user that is currently in your databaseNone
1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

0.0.1

9 months ago

1.0.0

10 months ago