Backend functionality to implement an oauth provider. DO NOT USE YET.