updated authorize handler