Internal oauth

Allows a different OAuth provider to be passed in. Does not change the behaviour of the code if one is not passed in, so will not break backwards compatibility.