From 36de3b32a9b19fdf865fca3fb9033d263d310f49 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Thu, 19 May 2022 19:15:48 +0200
Subject: [PATCH] Add option to disable Oauth when using CalCat proxy

---
 notebooks/LPD/LPD_Correct_Fast.ipynb | 3 ++-
 src/cal_tools/restful_config.yaml    | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/notebooks/LPD/LPD_Correct_Fast.ipynb b/notebooks/LPD/LPD_Correct_Fast.ipynb
index 33e904a2e..41bb8560d 100644
--- a/notebooks/LPD/LPD_Correct_Fast.ipynb
+++ b/notebooks/LPD/LPD_Correct_Fast.ipynb
@@ -207,10 +207,11 @@
     "# Connect to CalCat.\n",
     "calcat_config = restful_config['calcat']\n",
     "client = CalibrationClient(\n",
+    "    base_api_url=calcat_config['base-api-url'],\n",
+    "    use_oauth2=calcat_config['use-oauth2'],\n",
     "    client_id=calcat_config['user-id'],\n",
     "    client_secret=calcat_config['user-secret'],\n",
     "    user_email=calcat_config['user-email'],\n",
-    "    base_api_url=calcat_config['base-api-url'],\n",
     "    token_url=calcat_config['token-url'],\n",
     "    refresh_url=calcat_config['refresh-url'],\n",
     "    auth_url=calcat_config['auth-url'],\n",
diff --git a/src/cal_tools/restful_config.yaml b/src/cal_tools/restful_config.yaml
index 813d1467d..431799a72 100644
--- a/src/cal_tools/restful_config.yaml
+++ b/src/cal_tools/restful_config.yaml
@@ -15,6 +15,7 @@ calcat:
   refresh-url: https://in.xfel.eu/calibration/oauth/token
   scope: ''
   token-url: https://in.xfel.eu/calibration/oauth/token
+  use-oauth2: true
   user-email: calibration@example.com
   user-id: '@note add this to secrets file'
   user-secret: '@note add this to secrets file'
-- 
GitLab