Simple auth application with ExpressJS.

Overview

NodeJS JWT Authentication sample

This is a NodeJS API that supports username and password authentication with JWTs.

Available APIs

User APIs

POST /register

You can do a POST to /register to create a new user.

The body must have:

  • email: The email
  • password: The password

It returns the following:

{
  "message": "Success message Or Error message",
}

The message will depend on the execution if the email already exists, it will be an error message otherwise it will tell you that the registration was successful and that you will have to confirm it with the confirmation email.

POST /login

You can do a POST to /login to log.

The body must have:

  • email: The email
  • password: The password

It returns the following:

{
  "access_token": {jwt},
  "refresh_token": {jwt},
}

GET /verify/:token

You can do a GET to /verify/:token to confirm your registration.

It returns the following:

{
  "access_token": {jwt},
  "refresh_token": {jwt},
  "message": "success message",
}

GET /refreshToken

You can do a GET to /refreshToken to refresh your access token.

The JWT - refresh_token must be sent on the Authorization header as follows: Authorization: Bearer {jwt}

It returns the following:

{
  "access_token": {jwt}
}

Running it

Just clone the repository, run npm install and then node server.js. That's it :).

Issue Reporting

If you have found a bug or if you have a feature request, please contact me.

Author

MAOUCHE Yacine

License

This project is licensed under the MIT license. See the LICENSE file for more info.

You might also like...

A Remix Auth strategy for working with forms.

FormStrategy A Remix Auth strategy to work with any form. Supported runtimes Runtime Has Support Node.js ✅ Cloudflare ✅ How to use This Strategy gives

Jan 2, 2023

A collection of social media strategies for remix-auth

Remix Auth Socials A collection of Remix Auth strategies for Oauth2 Social logins. 👷 If you are interested in creating one of the planned strategies,

Jan 5, 2023

Remix Auth plugin for Twitter OAuth 1.0a

Remix Auth Twitter Remix Auth plugin for Twitter OAuth 1.0a. Supported runtimes Runtime Has Support Node.js ✅ Cloudflare ✅ Demo Try out live demo (sou

Dec 31, 2022

node.js project based jwt-auth / register-login-logout

JSON Web Token / Authentication-Authorization JSON Web Token allows us to check Authorization (Session Control). JSON Web Token (JWT) is an open stand

Sep 15, 2022

node.js project based jwt-auth / register-login-logout

JSON Web Token / Authentication-Authorization JSON Web Token allows us to check Authorization (Session Control). JSON Web Token (JWT) is an open stand

May 28, 2022

Remix Stack for deploying to Vercel with remix-auth, Planetscale, Radix UI, TailwindCSS, formatting, linting etc. Written in Typescript.

Remix Stack for deploying to Vercel with remix-auth, Planetscale, Radix UI, TailwindCSS, formatting, linting etc. Written in Typescript.

Remix Synthwave Stack Learn more about Remix Stacks. npx create-remix --template ilangorajagopal/synthwave-stack What's in the stack Vercel deploymen

Dec 25, 2022

Angular 14 JWT Authentication & Authorization with Web API and HttpOnly Cookie - Token Based Auth, Router, Forms, HttpClient, BootstrapBootstrap

Angular 14 JWT Authentication & Authorization with Web API and HttpOnly Cookie - Token Based Auth, Router, Forms, HttpClient, BootstrapBootstrap

Angular 14 JWT Authentication with Web API and HttpOnly Cookie example Build Angular 14 JWT Authentication & Authorization example with Web Api, HttpO

Dec 26, 2022

Firebase/Admin Auth Javascript Library for Cloudflare Workers

Flarebase Auth Firebase/Admin Auth Javascript Library for Cloudflare Workers Supported operations: createSessionCookie() verifySessionCookie() signInW

Jan 1, 2023

Login of app to remind to drink water, using Firebase tools like Firebase Auth and Firebase Firestore

Login of app to remind to drink water, using Firebase tools like Firebase Auth and Firebase Firestore

Water Reminder Login App Menu Contents Motivation Final Images How to download the project and run it? Technologies utilized Dev 📌 Motivation This ap

Aug 22, 2022
Owner
Yacine Maouche
I'm a passionate web developer and designer. I also love freelancing and contributing to open-source.
Yacine Maouche
This is a full-stack exercise tracker web application built using the MERN (MongoDB, ExpressJS, ReactJS, NodeJS) stack. You can easily track your exercises with this Full-Stack Web Application.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

WMouton 2 Dec 25, 2021
Auth-Form-Design - Beautiful Auth Form Designed using React 🥰.

?? Auth Form Design ?? Features 1. Check Your Password Strength 2. Can Use Suggested Password 3. Enjoy Responsive Design Getting Started with Create R

Samarpan Dasgupta 2 Dec 24, 2022
Firebase adepter auth process with custom token example in Next Auth

Firebase adepter auth process with custom token example in Next Auth Example of a firebase adapter that works with firebase authentication. A firebase

Low Front 10 Oct 14, 2022
Pim 4 Jun 21, 2022
Role based authentication for NodeJS and ExpressJS

Role based authentication Authentication service made for ExpressJS and MongoDB using JWT. We tried to make it as clean and structured as possible. We

null 4 Oct 3, 2021
@Ifycode's buuk API (nodejs, expressjs, mongodb)

@Ifycode/buuks-express-api Hosted on Heroku: https://buuks-express-api.herokuapp.com "Buuks" instead of "books"... Another angle ?? The API allows an

Obiagba Mary Ifeoma 7 Apr 21, 2022
A boilerplate for ExpressJs projects configured with ESLint, Prettier & Airbnb Setup. The boilerplate utilises RESTful architecture and uses Mongodb.

ExpressJs-Boilerplate An ExpressJs boilerplate configured with ESLint, Prettier & Airbnb Setup. The boilerplate utilises RESTful architecture and uses

Hammas bin Farrukh 4 Mar 8, 2023
Learn how to set up Supabase auth for both the frontend and backend of your application using a JWT - JSON web token.

Supabase auth, frontend + backend - example with Next.js Learn how to set up Supabase auth for both the frontend and backend of your application using

YK 7 Nov 20, 2022
NPM Package that simplifies Auth with Google OAuth2 🔐

Node Google OAuth2 ?? A simple authentication flow for Google OAuth2 Explore the docs » Report Bug Table of Contents About The Project Getting Started

Adarsh C 8 Jun 17, 2022
An unofficial, simplified version of the @Shopify/koa-shopify-auth middleware library.

simple-koa-shopify-auth https://www.npmjs.com/package/simple-koa-shopify-auth NOTE: This package is not maintained by or affiliated with Shopify. Desc

David 20 Nov 7, 2022