hapi-auth-jwt2 | Secure Hapi.js authentication plugin using JSON Web Tokens | Authentication library
kandi X-RAY | hapi-auth-jwt2 Summary
kandi X-RAY | hapi-auth-jwt2 Summary
:lock: Secure Hapi.js authentication plugin using JSON Web Tokens (JWT) in Headers, URL or Cookies
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- custom helper functions
hapi-auth-jwt2 Key Features
hapi-auth-jwt2 Examples and Code Snippets
Community Discussions
Trending Discussions on hapi-auth-jwt2
QUESTION
I am using Hapi-auth-jwt2 and facing an issue after my JWT expire, instead of getting a 401 error I am getting 500 server error,
Here is my code:
...ANSWER
Answered 2021-Aug-06 at 21:21 statusCode: Joi.any().optional().example(401),
error: Joi.any().example("Unauthorized"),
message: Joi.any().example("Missing authentication"),
attributes: {error: "Expired token"}
}).label("Unauthorized Error");
QUESTION
Since, Hapi Utilises its own separate JWT package. like - Bell || HapiAuthJWT2 .
And I failed to find any plugin which is being mantained for passport being able to handle Hapi Request APIs.
The alternative solution is probably to use the DocuSign server APIs directly.
...ANSWER
Answered 2021-Feb-15 at 19:36docusign-passport is a plugin strategy for passport.
Hapi's authentication appears to be different. Plus, you referenced JWT authentication. JWT grant is completely different from the Authentication Code grant flow used by passport and its plugins.
The developer center includes information on creating a JWT token for the DocuSign IdPs.
Note that the JWT is signed using the RS256 algorithm.
AddedRe: is a custom plugin needed for HAPI? I don't know, I haven't used HAPI. But even if DocuSign-specific code is needed, it should be straight-forward since DocuSign uses common patterns for its JWT and Authorization Code grant support.
Re: JWT vs Passport. Passport is for authorization code grant. It works well for that OAuth flow. If you want to use the JWT grant flow, it is not supported by the Passport library, AFAIK.
QUESTION
I have just started to learn hapi.js. And I'm trying to understand the code of auth. How this works. For that, I followed hapi-auth-jwt2.
After that when I call the API from the postman, I didn't get any output.
This is my server.js
file and I run node server.js
.
ANSWER
Answered 2020-Jan-08 at 14:45You will need to create a token for each user (people
) by using the (secret) key like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hapi-auth-jwt2
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page