Index: trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java	(revision 18785)
+++ trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java	(revision 18786)
@@ -102,10 +102,11 @@
                 } catch (IOException | OAuth20Exception e) {
                     consumer.accept(Optional.empty());
-                    throw new JosmRuntimeException(e);
+                    throw new RequestHandler.RequestHandlerErrorException(e);
                 } finally {
                     tradeCodeForToken.disconnect();
                 }
             } catch (MalformedURLException e) {
-                throw new JosmRuntimeException(e);
+                consumer.accept(Optional.empty());
+                throw new RequestHandler.RequestHandlerBadRequestException(e);
             }
             return null;
Index: trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java	(revision 18785)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java	(revision 18786)
@@ -21,4 +21,5 @@
 import javax.swing.JCheckBox;
 import javax.swing.JLabel;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 
@@ -375,4 +376,10 @@
                     OAuthAccessTokenHolder.getInstance().save(CredentialsManager.getInstance());
                     GuiHelper.runInEDT(OAuthAuthenticationPreferencesPanel.this::refreshView);
+                    if (!token.isPresent()) {
+                        GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(MainApplication.getMainPanel(),
+                                tr("Authentication failed, please check browser for details."),
+                                tr("OAuth Authentication Failed"),
+                                JOptionPane.ERROR_MESSAGE));
+                    }
                 }, OsmScopes.read_gpx, OsmScopes.write_gpx,
                         OsmScopes.read_prefs, OsmScopes.write_prefs,
