I'm using this token authentication implementation: https://ift.tt/2NzY8ux the problem is, that the "verify" function is only called when the route needs to be authenticated. I'm implementing an app that returns a list of items, but if user is logged in (i.e., sends a JWT), a special attribute is added to the JSON that is returned. The data is identical, just a special attribute is added if the user is logged in.Since I can't reuse the auth.strategy('jwt', I manually implemented that I check the header for a token and decode it in that specific route. If the user is logged in, I get the id from the token, otherwise I return null.Now it seems a bit shady to me that I have an authentication strategy, yet somehow "hack" the decode process in that specific path.What would be the best solution here?
Submitted October 12, 2018 at 09:33AM by JavascriptFanboy
No comments:
Post a Comment