added code to onAuth