Coder Social home page Coder Social logo

btx-auth-server's Introduction

A REST-based authentication API built with node.js, express.js, and MongoDB. Uses JSON web tokens (JWTs) to protect most API routes.

Testing this authentication API in Postman

-- In a shell:

Run mongod

In the project directory, run: npm start

--

In Postman:

  1. Register a user by sending a JSON POST request to:

localhost:3005/users/register

returns an empty object: {}


  1. Authenticate a user by sending a JSON Post request to:

http://localhost:3005/users/authenticate

{ "username": "[email protected]", "password": "jsm1th" }

returns a user object that contains a token property: { "_id": "5ced4d4f2167ae7bea21e637", "firstName": "James", "lastName": "Smith", "username": "[email protected]", "email": "[email protected]", "role": "admin", "dateCreated": "2019-05-28T15:01:35.206Z", "acceptedLicense": "2019-05-28T15:01:35.206Z", "__v": 0, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1Y2VkNGQ0ZjIxNjdhZTdiZWEyMWU2MzciLCJpYXQiOjE1NTkwNTU3NDJ9.9z3mfOVgI3A6fl1KO2TdrQ2kC43lPAAGMDamOkcqr4Y" }


  1. Issue a GET with Bearer Token to:

http://localhost:3005/users/listall

Use the token returned by the authentication POST request, above. The user agent sends the JWT, typically in the Authorization header using the Bearer schema.

will return a list of user objects

btx-auth-server's People

Contributors

ddoherty avatar

Watchers

 avatar

btx-auth-server's Issues

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.