An API that connects multiple Microsoft services, enabling data access and automation across platforms
are you using application permission access scenario to call the create task api ? (users/{id|userPrincipalName}/todo/lists/{todoTaskListId}/tasks)
According to the documentation application permission are not supported for the creating Task.
for more details
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.