authorize function that gets auth token