Simplify OAuth code by using common libraries

Part of #30 - this should work on windows now.