Index: trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java	(revision 18661)
+++ trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java	(revision 18662)
@@ -93,4 +93,5 @@
                         + (this.codeVerifier != null ? "&code_verifier=" + this.codeVerifier : "")
                 ).getBytes(StandardCharsets.UTF_8));
+                tradeCodeForToken.setHeader("Content-Type", "application/x-www-form-urlencoded");
                 try {
                     tradeCodeForToken.connect();
Index: trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java	(revision 18661)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java	(revision 18662)
@@ -180,7 +180,11 @@
             } else if (rbOAuth.isSelected()) {
                 pnlAuthenticationParameters.add(pnlOAuthPreferences, BorderLayout.CENTER);
+                pnlOAuthPreferences.saveToPreferences();
+                pnlOAuthPreferences.initFromPreferences();
                 pnlOAuthPreferences.revalidate();
             } else if (rbOAuth20.isSelected()) {
                 pnlAuthenticationParameters.add(pnlOAuth20Preferences, BorderLayout.CENTER);
+                pnlOAuth20Preferences.saveToPreferences();
+                pnlOAuth20Preferences.initFromPreferences();
                 pnlOAuth20Preferences.revalidate();
             }
