updated to use we oauth 2 and move some code to auth plugin