[PoC][WIP] Rewrite OAuth plugin

@mtdowling Note this is PoC, not tested in wildness, will try to do this in upcoming days.