Only do oauth redirect uri rewriting on server, where we have env vars

Also, unset 'params' if it becomes empty after deleting keys. Empty
params produces http://foo.com?, where undefined params produces
http://foo.com.
Fix oauth cordova popup error logging