Client authorization handler

This code is about handling client-side authorization on the API server.