BUGFIX: OAuth2 fix

Fixed several bugs in the CredentialStore and callback URL generator that caused OAuth 2.0 endpoints to misbehave.