hooked api in auth logic