I think this refactoring might warrant a bit more of a change. This function doesn't appear to just be checking if the bearer token is valid. It's checking that the auth header is valid and contains a valid bearer token.