Add authentication function.