Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
query/sessions: return 401 for invalid Bearer token (#1379)
Currently passing a `Authorization: Bearer ...` header with a token that fails the `isValidToken()` check will return a 500 response. To recreate: ``` $ curl https://dev.getodk.cloud/v1/projects/1 --header 'Authorization: Bearer hi' {"message":"Internal Server Error"} ``` vs ``` $ curl https://dev.getodk.cloud/v1/projects/1 --header 'Authorization: Bearer aaaaaaaabbbbbbbbccccccccddddddddaaaaaaaabbbbbbbbccccccccdddddddd' {"message":"Could not authenticate with the provided credentials.","code":401.2} ``` From Sentry (https://getodk.sentry.io/issues/6194482982/?environment=production&project=5724763&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&statsPeriod=30d&stream_index=2), when the supplied token is invalid, `authHandler` can throw.
- Loading branch information