Fixed incorrect variable names
Use cookie tokens to reduce oauth redirects

At the end of the oauth flow, persist a token in sqlite instead of
relying on session state. This should increase responsiveness by
cutting down on redirects to and from the oauth endpoint.