Giter VIP home page Giter VIP logo

passport-tutorial's Introduction

Passport-Tutorial

Node.js authentication tutorial using Passport.js

Prerequisites

Make sure you have these installed on your machine

  • Node.js
  • MongoDB
  • npm This comes with Node.js, but make sure you check if you have it anyway

Installing packages

Install packages

npm i

Running the app

To run the app (dev. mode)

npm start

Built With

Authors

Acknowledgments

passport-tutorial's People

Contributors

antonioerdeljac avatar chorsnell avatar dependabot[bot] avatar titou26140 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passport-tutorial's Issues

TypeError: Cannot read property 'email' of undefined

clonning the code and running it and when try to hit the endpoint with postman i'm getting this error

TypeError: Cannot read property 'email' of undefined
at router.post (/home/edward/Stuff/passport-tutorial/routes/api/users.js:11:15)
at Layer.handle [as handle_request] (/home/edward/Stuff/passport-tutorial/node_modules/express/lib/router/layer.js:95:5)

what can be doing this?

TypeError: Cannot read property 'email' of undefined

Hello, I was testing your package through Postman but it gives me the following error whenever I send the request. Is there something wrong with jwt module?

POST /api/users 500 20.881 ms - 2421 TypeError: Cannot read property 'email' of undefined at router.post (..../api/users.js:11:11)

Line 64 of user.js

Shouldn't it be response.status(400).json(info) instead of response.status(400).info?

Invalid Token when hitting api with auth.required

throwing UnauthorizedError: invalid token error

headers :
{ authorization: 'Token j%3A%7B%22token%22%3A%22eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImJhbnNhbG5pdGluOTJAZ21haWwuY29tIiwiaWQiOiI1YzFlOGVhMWM3MmRkNzRlODczZDE4M2EiLCJleHAiOjE1NTA3Mzc3MjksImlhdCI6MTU0NTU1MzcyOX0.cZymBkHkJayipmkUpPIUNWrOgzQ7qxk4RugZ70g-3ls%22%7D',
'content-type': 'application/json',
'cache-control': 'no-cache',
'postman-token': '91df4d01-6a0e-434e-ad91-60c9bb38f319',
'user-agent': 'PostmanRuntime/7.3.0',
accept: '/',
host: 'localhost:8081',
'accept-encoding': 'gzip, deflate',
connection: 'keep-alive' }

I tried this on Postman and Browser using cookies both. But getting same error. Could you please help me out here.

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.