Support for sign-in & sign-up via OAuth resource owner

Rebased version of #163.