basic API authentication function working