finished authentication function