Conditionally check if a get request is authenticated or public

You should be able to tell if the request has a user associated with it (i.e is an authenticated request) by checking for the existence of ctx.state.user. E.g

const isAuthenticated = !!ctx.state.user;
if (isAuthenticated) {
  ...
} else {
  ...
}