Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants