fix double render on api when token is invalid