You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we needed a way to add custom extractor for jwt, as we are using passport for authenticating on third party webhook which sends the token inside nested field in body, another reason is to authenticate for websocket handshake as mentioned in this Issue.
So my approach is to use a custom extractor which takes JwtFromRequestFunction as argument.
Here is the diff that solved my problem:
diff --git a/node_modules/passport-jwt/lib/extract_jwt.js b/node_modules/passport-jwt/lib/extract_jwt.js
index 7f112ab..392fa82 100644
--- a/node_modules/passport-jwt/lib/extract_jwt.js+++ b/node_modules/passport-jwt/lib/extract_jwt.js@@ -71,6 +71,10 @@ extractors.fromAuthHeaderAsBearerToken = function () {
return extractors.fromAuthHeaderWithScheme(BEARER_AUTH_SCHEME);
};
+extractors.fromCustomExtractor = function (extractor_callback) {+ return extractor_callback;+};+
extractors.fromExtractors = function(extractors) {
if (!Array.isArray(extractors)) {
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.I think we needed a way to add custom extractor for jwt, as we are using passport for authenticating on third party webhook which sends the token inside nested field in body, another reason is to authenticate for websocket handshake as mentioned in this Issue.
So my approach is to use a custom extractor which takes
JwtFromRequestFunction
as argument.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: