Skip to content

AuthnApp is a backend project that provides authentication and authorization services. It includes endpoints for user registration, login, and token generation for secure API access. The project ensures that only authorized users can access certain routes by validating tokens and checking user roles.

Notifications You must be signed in to change notification settings

dhyaneshsiddhartha15/authnapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AuthNApp

AuthNApp is a backend application that provides authentication and authorization services. It includes controllers and models for managing user authentication and authorization. The application checks whether a user is authorized to access a particular route and verifies if the user's role is authenticated.

Installation

To run the AuthNApp locally, follow these steps:

  1. Clone the repository: git clone https://github.com/your-username/AuthNApp.git
  2. Install dependencies: npm install
  3. Set up your environment variables:
    • Create a .env file in the root directory
    • Add the following variables to your .env file:
      PORT=3000
      DATABASE_URL=mongodb://localhost:27017/authnapp
      JWT_SECRET=your_jwt_secret_here
      
  4. Start the server: npm start
  5. The server should now be running on http://localhost:3000

Usage

Register a User

To register a new user, send a POST request to /api/auth/register with a JSON payload containing email, password, and role:

{
  "email": "[email protected]",
  "password": "password123",
  "role": "user"
}

About

AuthnApp is a backend project that provides authentication and authorization services. It includes endpoints for user registration, login, and token generation for secure API access. The project ensures that only authorized users can access certain routes by validating tokens and checking user roles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published