johnbrett / hapi-auth-bearer-token

Simple Bearer authentication scheme plugin for hapi, accepts token by Header, Cookie or Query parameter.
MIT License
218 stars 46 forks source link

bug: don't throw h.unauthenticated #204

Closed kkuehlz closed 4 years ago

kkuehlz commented 4 years ago

bug: don't throw h.unauthenticated

When throwing h.unathenticated, hapi will intercept that error, and replace it with its own 500 error:

Debug: internal, implementation, error Error: Cannot throw non-error object

This makes debugging a broken validate function very confusing, because hapi eats "bad token string [..]" error message and replaces it with the above.

johnbrett commented 4 years ago

Nice catch on this @keur, will merge and publish as a patch.

johnbrett commented 4 years ago

Published in v6.1.5