(bug 4062) Initial OAuth implementation

This currently does not allow anyone to use OAuth to auth anywhere
but allows the OAuth token process to work.
(bug 4062) Fix protocol version related code
(bug 4062) Fix various concerns
(bug 4062) Refactor code to remove indent
(bug 4062) Missed explicit protocol_version
Merge pull request #506 from anall/feature/bug4062

OAuth stuff