Implements OAuth both server and client side (bug 905806)