Code Monkey home page Code Monkey logo

auth-microapi's Introduction

Auth-Micro API

A microapi to allow easy integration of authentication into your service

Usage

Go to support website ๐ŸŽˆ

Contributions

https://docs.google.com/spreadsheets/d/1aNd-d2mQIOHOYnCLvG1wHn7pYS2XqHnmDSzABABQTBI/edit?usp=sharing

Features

  • Login/logout/register + session expiry
  • Secure routing
  • Email verification
  • Password recovery ("forgot password")
  • Password reset ("update password")
  • Social authentication ("twitter, facebook, github, google")
  • Rate limiting ("lockout on unsuccessful login attempts")
  • Persistent login ("remember me")

Prerequisites:

  • node v~12.16.0
  • npm v~6.14.5
  • MongoDB Atlas URI, Sendgrid APIKEY, Social Auth keys

Setup:

  • cd auth-microapi
  • cp sample.env .env
  • add MongoDB URI, and Sengrid APIkey in .env
  • npm install
  • npm run dev

Test

Use Postman to test endpoints

API

Method URI PARAMS HEADERS Services
POST api/auth/admin/register email, username, password, phone_number application/json Register as new admin/service user
POST api/auth/admin/getkey email, password application/json Get APIkey for admin
POST api/auth/admin/reset-password email application/json Make request to reset admin password if forgotten
PATCH api/auth/admin/reset-password/:token password, password_confirmation application/json Reset admin password
POST api/auth/user/register email, username, password, phone_number application/json, Authorization: Bearer token As an admin, register your user
GET api/auth/user/email-verification/:token - application/json, Authorization: Bearer token Verify user email
GET api/auth/user/email-verification/resend - application/json, Authorization: Bearer token Resend email verification link for user
POST api/auth/user/login email, password application/json, Authorization: Bearer token Login user
POST api/auth/user/password/reset email application/json, Authorization: Bearer token Request to reset password for user in case of forgotten password
PATCH api/auth/user/password/:token password, password_confirmation application/json, Authorization: Bearer token Reset user password
GET api/auth/user/logout - Authorization: Bearer token Logout user
GET api/auth/facebook ------ Authorization: Bearer token Register/Login with facebook
GET api/auth/twitter ------ Authorization: Bearer token Register/Login with twitter
GET api/auth/github ------ Authorization: Bearer token Register/Login with github
GET api/auth/google ------ Authorization: Bearer token Register/Login with google
  • *(get Authorization token from api/admin/auth/getkey)

Contribution Guide:

Please always follow the right format before making pull request

  • Fork this repository into your remote repository
  • Clone the code from your remote repository into your local machine git clone <url>
  • Create a branch with the feature name you wish to work on git checkout -b <name_of_feature>
  • Add any changes
  • Create an upstream on your local machine to pull the latest code from the develop branch of this repository git remote add upstream develop and git pull upstream develop
  • Push to the remote branch which you forked git add . | git commit -m "cool feature" | git push origin <name_of_feature>
  • Make a pull request to the develop branch of this repository

auth-microapi's People

Contributors

aeesha-t avatar alkaseem avatar aptcoder avatar bamz-west avatar botus14 avatar ceofred avatar coolheaded1 avatar dave-ok avatar dejetem avatar esi-meci avatar everybees avatar gosteve2705 avatar hackinwaledev avatar horlathunbhosun avatar jaybarnes33 avatar jeremiahiro avatar kangbreder avatar mcsepro avatar mhizterkeyz avatar miracle-e avatar neymarjimoh avatar obiagwunnamdi1 avatar ojay-dev avatar okputu-e avatar oscar-ekeyekwu avatar piouson avatar ruzor avatar sambalicious avatar simply-alliv avatar usman-07 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.