You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documentation on default auth strategy incorrect? #459
What are you trying to achieve or the steps to reproduce ?
I'm building an API where all routes are protected by a token based auth strategy. Now I'm trying to register a /health route, which should be exempt from the authentication for obvious reasons.
According to the documentation, defining the route before setting a default auth strategy should yield the desired behaviour:
Note that any routes added before server.auth.default() is called will not have the default applied to them.
However, with the following code (simplified to the relevant parts), I still get a 401 error when calling the /health endpoint:
on the /health route successfully disables authentication.
I'm unsure whether this is expected behaviour and the documentation is just incorrect, or whether this constitutes a bug. I'm happy to provide a PR for a fix either way, if you can clarify.
Hey, thanks for catching this! I believe the issue is just that the documentation is incorrect as of hapi v17. I am going to transfer this issue to the hapi.dev repo where this content lives 👍
Activity
devinivy commentedon Apr 14, 2021
Hey, thanks for catching this! I believe the issue is just that the documentation is incorrect as of hapi v17. I am going to transfer this issue to the hapi.dev repo where this content lives 👍
lauraseidler commentedon Apr 14, 2021
Great - I can prepare a PR tomorrow (at least for the English version - not sure how translations would be handled here).