Add authentication function