Some factoring on the authentication code.
Fix problem when trying to add a mark while not authenticated.

Previously everything would go wrong as the query string would cause
the the match against the OAuth redirect URL to fail.  Turns out we
can specify the redirection URL from the code which means that we
don't pass through the query string and so avoid failing the
authentication.  Now rather than reading the query string directly we
save a copy to local storage before authentication, and read it back
afterwards.