Need to quote parameters.

- Also ensure that the scope is properly purged if the stored
  credentials failed.