Separate query for authentication and authorization