GithubHelp home page GithubHelp logo

Comments (2)

is2ei avatar is2ei commented on May 9, 2024

@mkgn

Is this call back needed (as per passport-jwt documentation?)

This question is not for fastify-passport. You should ask it in passport-jwt community.


Is below call back the proper place to validate the jwt and authenticate user against database?

The purpose of callback option is described in the README.

https://github.com/fastify/fastify-passport#authenticatestrategy-string--strategy--string--strategy-options-authenticateoptions-callback-authenticatecallback

An optional callback can be supplied to allow the application to override the default manner in which authentication attempts are handled. The callback has the following signature:


My question is out of the two places (mentioned in Question -1 & Question -2) what is the correct place I should use to do the user authentication/validation.

Did you try registerUserDeserializer?

https://github.com/fastify/fastify-passport#registeruserdeserializerdeserializer-serializeduser-request--promise

Registers an async user deserializer function for taking a low level serialized user object (often just a user ID) from a session, and deserializing it from storage into the request context. @fastify/passport cannot store rich object classes in the session, only JSON objects, so you must register a serializer / deserializer pair if you want to say fetch a User object from your database, and store only a user ID in the session.

from fastify-passport.

mkgn avatar mkgn commented on May 9, 2024

Sorry it's difficult to sometimes understand where the question should go to because this plugin is pretty much tight to passport.js. I will try it there. Meanwhile I used fastify/jwt and got the job done until I resolve this.

from fastify-passport.

Related Issues (20)

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.