Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling response object from "before" callback #189

Open
geshub opened this issue Jun 28, 2020 · 3 comments
Open

Calling response object from "before" callback #189

geshub opened this issue Jun 28, 2020 · 3 comments

Comments

@geshub
Copy link

geshub commented Jun 28, 2020

I'm using version 3.4 and I'm running some checks based on the decoded token in the "before" callback just after the token has been validated.
The problem is that if one of the check fails, I can't return a 401 from the callback as I can't access the response object.
I've seen it was possible in the previous version.
Is there any way I can call the error callback from "before", halt the execution or do I need to do my checks in another middleware called after the token is validated ?

@malaDev
Copy link

malaDev commented Nov 30, 2020

maybe you should use 'after' instead. it is intended to run after jwt checking done

@markoheijnen
Copy link

'before' is also after the JWT checking. The possible problem is that other middleware have run then as well which may not be desired.

@LeonardoYoel
Copy link

@geshub have you managed to solve that problem, do I have the same situation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants