add oauth support

This code adds basic OAuth support
I'm fine with both of us there, just not sure about the format. But let's keep it as it is.