Implement OAuth

This replaces the hacky token-based authentication with OAuth based on https://github.com/prose/gatekeeper.

Closes #1