Skip to content

How do you redirect if a token has expired? #161

@jacobtipp

Description

@jacobtipp

This seems a bit trivial, however, I have not used JWT with Hapi.js before. Currently I am testing my auth flow by having a user login via a form, and wrapping a cookie with a JWT back to the client. For testing purposes I'm making the token expire in 1 minute. I want to be able to redirect to the /login view if the token has expired. The default behavior for this plugin seems to be a 401 response, which makes sense but if I want to capture this and redirect, I'm not exactly sure how to do it. I've tried setting ignoreExpiration to true, but I believe validateFunc isn't responsible for redirects of any kind.

Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions