From 51fddd89cbd8fe20d3028d5cd118d58aabbe1277 Mon Sep 17 00:00:00 2001
From: marvin78 <marvin78@users.noreply.github.com>
Date: Tue, 3 Jan 2023 12:58:56 +0000
Subject: [PATCH] 98_todoist.pm: change header - key

git-svn-id: https://svn.fhem.de/fhem/trunk@26953 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
 fhem/CHANGED            |  1 +
 fhem/FHEM/98_todoist.pm | 20 +++++++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/fhem/CHANGED b/fhem/CHANGED
index 33a19d5a7..cfd0b52fc 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
 # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
 # Do not insert empty lines here, update check depends on it.
+ - bugfix:  98_todoist: key in header
  - feature: 36_ShellyMonitor: Support Shelly3EM correctly
  - feature: 70_ESCVP21net: optimze help text
  - feature: 70_SVDRP: optimize help text
diff --git a/fhem/FHEM/98_todoist.pm b/fhem/FHEM/98_todoist.pm
index aa7d3d7d7..5f7835a66 100644
--- a/fhem/FHEM/98_todoist.pm
+++ b/fhem/FHEM/98_todoist.pm
@@ -17,7 +17,7 @@ eval "use Date::Parse;1" or $missingModule .= "Date::Parse ";
 
 #######################
 # Global variables
-my $version = "1.3.13";
+my $version = "1.3.15";
 my $apiUrl = "https://api.todoist.com/sync/v9/";
 
 my $srandUsed;
@@ -332,7 +332,8 @@ sub todoist_ReorderTasks ($$) {
         method     => $method,
         wType      => "reorder",
         timeout    => 7,
-        header     => "Content-Type: application/x-www-form-urlencoded",
+        header     => "Content-Type: application/x-www-form-urlencoded\r\n".
+					  "Authorization: Bearer ".$pwd,
         hash       => $hash,
         callback   => \&todoist_HandleTaskCallback,  ## call callback sub to work with the data we get
       };
@@ -591,7 +592,8 @@ sub todoist_UpdateTask($$$) {
         wType      => $type,
         taskId     => $taskId,
         timeout    => 7,
-        header     => "Content-Type: application/x-www-form-urlencoded",
+        header     => "Content-Type: application/x-www-form-urlencoded\r\n".
+					  "Authorization: Bearer ".$pwd,
         hash       => $hash,
         callback   => \&todoist_HandleTaskCallback,  ## call callback sub to work with the data we get
       };
@@ -720,7 +722,8 @@ sub todoist_CreateTask($$) {
           wType      => "create",
           parentId   => $parentId,
           timeout    => 7,
-          header     => "Content-Type: application/x-www-form-urlencoded",
+          header     => "Content-Type: application/x-www-form-urlencoded\r\n".
+					    "Authorization: Bearer ".$pwd,
           hash       => $hash,
           callback   => \&todoist_HandleTaskCallback,  ## call callback sub to work with the data we get
         };
@@ -894,7 +897,8 @@ sub todoist_GetTasks($;$) {
         url        => $url,
         method     => "POST",
         data       => $data,
-        header     => "Content-Type: application/x-www-form-urlencoded",
+		header     => "Content-Type: application/x-www-form-urlencoded\r\n".
+					  "Authorization: Bearer ".$pwd,
         timeout    => 7,
         completed  => $completed,
         hash       => $hash,
@@ -1199,7 +1203,8 @@ sub todoist_GetUsers($) {
         data       => $data,
         timeout    => 7,
         method     => "POST",
-        header     => "Content-Type: application/x-www-form-urlencoded",
+        header     => "Content-Type: application/x-www-form-urlencoded\r\n".
+					  "Authorization: Bearer ".$pwd,
         hash       => $hash,
         callback   => \&todoist_GetUsersCallback,  ## call callback sub to work with the data we get
       };
@@ -1339,7 +1344,8 @@ sub todoist_GetProjects($) {
         data       => $data,
         timeout    => 7,
         method     => "POST",
-        header     => "Content-Type: application/x-www-form-urlencoded",
+        header     => "Content-Type: application/x-www-form-urlencoded\r\n".
+					  "Authorization: Bearer ".$pwd,
         hash       => $hash,
         callback   => \&todoist_GetProjectsCallback,  ## call callback sub to work with the data we get
       };