From fc9dd462399a3b7ed8959c38c4a97f24895f9ca8 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 1 Sep 2023 22:31:46 +0200 Subject: [PATCH] Fix: fix tests; use OAuth client id from dedicated MapComplete account --- src/Logic/Osm/OsmConnection.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Logic/Osm/OsmConnection.ts b/src/Logic/Osm/OsmConnection.ts index 557a1a7fa..9e689a07c 100644 --- a/src/Logic/Osm/OsmConnection.ts +++ b/src/Logic/Osm/OsmConnection.ts @@ -34,11 +34,18 @@ export type OsmServiceState = "online" | "readonly" | "offline" | "unknown" | "u export class OsmConnection { public static readonly oauth_configs: Record = { - osm: { + osm_pietervdvn: { + // This client_id is registered by "Pieter Vander Vennet" on OSM.org oauth_client_id: 'sa1ngLJBJ8McmzHElN8NYtIDm5TZTYEYhq3-0snO4Qc', oauth_secret: 'XU_cD5Mvw9VKk9T0t_gO8V7cbRC4Hmw2Tb4Rv0Zmz-U', url: "https://www.openstreetmap.org", }, + osm: { + // This client-id is registered by "MapComplete" on osm.org + oauth_client_id: "K93H1d8ve7p-tVLE1ZwsQ4lAFLQk8INx5vfTLMu5DWk", + oauth_secret: "NBWGhWDrD3QDB35xtVuxv4aExnmIt4FA_WgeLtwxasg", + url: "https://www.openstreetmap.org", + }, "osm-test": { oauth_client_id: "HwUn6GPxGm1m9WwMarxTglhy6dBTM4YkaV1I9h6pDGU", oauth_secret: "luFZtPJg7j96K6WM6RpcZ_3M-r6muuDq6fG1ygk0I_4", @@ -192,7 +199,7 @@ export class OsmConnection { const self = this console.log("Trying to log in...") this.updateAuthObject() - LocalStorageSource.Get("location_before_login").setData(window.location.href) + LocalStorageSource.Get("location_before_login").setData(Utils.runningFromConsole ? undefined : window.location.href) this.auth.xhr( { method: "GET", @@ -488,7 +495,7 @@ export class OsmConnection { client_id: this._oauth_config.oauth_client_id, url: this._oauth_config.url, scope: "read_prefs write_prefs write_api write_gpx write_notes", - redirect_uri: window.location.protocol + "//" + window.location.host + "/land.html", + redirect_uri: Utils.runningFromConsole ? "https://mapcomplete.org/land.html" : window.location.protocol + "//" + window.location.host + "/land.html", singlepage: !standalone, auto: true, })