Index: trunk/src/org/openstreetmap/josm/data/oauth/IOAuthAuthorization.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/IOAuthAuthorization.java	(revision 18662)
+++ trunk/src/org/openstreetmap/josm/data/oauth/IOAuthAuthorization.java	(revision 18665)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.data.oauth;
 
+import java.util.Optional;
 import java.util.function.Consumer;
 
@@ -16,4 +17,4 @@
      * @param scopes The scopes to ask for
      */
-    void authorize(IOAuthParameters parameters, Consumer<IOAuthToken> consumer, Enum<?>... scopes);
+    void authorize(IOAuthParameters parameters, Consumer<Optional<IOAuthToken>> consumer, Enum<?>... scopes);
 }
Index: trunk/src/org/openstreetmap/josm/data/oauth/IOAuthParameters.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/IOAuthParameters.java	(revision 18662)
+++ trunk/src/org/openstreetmap/josm/data/oauth/IOAuthParameters.java	(revision 18665)
@@ -91,4 +91,7 @@
     }
 
+    /**
+     * Store the preferences for these parameters
+     */
     void rememberPreferences();
 }
Index: trunk/src/org/openstreetmap/josm/data/oauth/IOAuthToken.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/IOAuthToken.java	(revision 18662)
+++ trunk/src/org/openstreetmap/josm/data/oauth/IOAuthToken.java	(revision 18665)
@@ -13,4 +13,5 @@
      * Sign a client
      * @param client The client to sign
+     * @throws OAuthException if the OAuth token type is unknown (AKA we do't know how to handle it)
      */
     void sign(HttpClient client) throws OAuthException;
Index: trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java	(revision 18662)
+++ trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java	(revision 18665)
@@ -13,4 +13,5 @@
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.UUID;
 import java.util.function.Consumer;
@@ -45,5 +46,5 @@
 
     @Override
-    public void authorize(IOAuthParameters parameters, Consumer<IOAuthToken> consumer, Enum<?>... scopes) {
+    public void authorize(IOAuthParameters parameters, Consumer<Optional<IOAuthToken>> consumer, Enum<?>... scopes) {
         final String state = UUID.randomUUID().toString();
         final String codeVerifier = UUID.randomUUID().toString(); // Cryptographically random string (ASCII)
@@ -62,8 +63,8 @@
         private final String state;
         private final IOAuthParameters parameters;
-        private final Consumer<IOAuthToken> consumer;
+        private final Consumer<Optional<IOAuthToken>> consumer;
         private final String codeVerifier;
 
-        OAuth20AuthorizationHandler(String state, String codeVerifier, IOAuthParameters parameters, Consumer<IOAuthToken> consumer) {
+        OAuth20AuthorizationHandler(String state, String codeVerifier, IOAuthParameters parameters, Consumer<Optional<IOAuthToken>> consumer) {
             this.state = state;
             this.parameters = parameters;
@@ -98,7 +99,7 @@
                     HttpClient.Response response = tradeCodeForToken.getResponse();
                     OAuth20Token oAuth20Token = new OAuth20Token(parameters, response.getContentReader());
-                    consumer.accept(oAuth20Token);
+                    consumer.accept(Optional.of(oAuth20Token));
                 } catch (IOException | OAuth20Exception e) {
-                    consumer.accept(null);
+                    consumer.accept(Optional.empty());
                     throw new JosmRuntimeException(e);
                 } finally {
Index: trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Token.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Token.java	(revision 18662)
+++ trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Token.java	(revision 18665)
@@ -20,4 +20,5 @@
 import org.openstreetmap.josm.tools.HttpClient;
 import org.openstreetmap.josm.tools.JosmRuntimeException;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -81,5 +82,6 @@
     @Override
     public void sign(HttpClient client) throws OAuthException {
-        if (!this.oauthParameters.getApiUrl().contains(client.getURL().getHost())) {
+        if (!Utils.isBlank(this.oauthParameters.getApiUrl())
+                && !this.oauthParameters.getApiUrl().contains(client.getURL().getHost())) {
             String host = URI.create(this.oauthParameters.getAccessTokenUrl()).getHost();
             throw new IllegalArgumentException("Cannot sign URL with token for different host: Expected " + host
