added common authorization helper function