First modifications to the api to include both kinds of authentication (key and three legged). Work in progress.