Microsoft Graph API Beta ToDo List API Fails with 401

347 Views Asked by At

EDIT: I have successfully used the endpoint with my business Office365 account. I would like to use this in conjunction with my personal account since it has the shared data I am looking to access. Is there some fundamental aspect that prevents me from accessing this information through these APIs?

I have tried to perform the "my To Do task lists" https://graph.microsoft.com/beta/me/todo/lists with the Microsoft Graph Explorer Tool at https://developer.microsoft.com/en-us/graph/graph-explorer

I have set the Tasks.ReadWrite consent for the token, and it lists it "Consented" in the "Modify Permissions" tab. However, calling the API just returns a 401 error with a very unhelpful message:

{
    "error": {
        "code": "UnknownError",
        "message": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/>\r\n<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>\r\n<style type=\"text/css\">\r\n<!--\r\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\r\nfieldset{padding:0 15px 10px 15px;} \r\nh1{font-size:2.4em;margin:0;color:#FFF;}\r\nh2{font-size:1.7em;margin:0;color:#CC0000;} \r\nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \r\n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:\"trebuchet MS\", Verdana, sans-serif;color:#FFF;\r\nbackground-color:#555555;}\r\n#content{margin:0 0 0 2%;position:relative;}\r\n.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}\r\n-->\r\n</style>\r\n</head>\r\n<body>\r\n<div id=\"header\"><h1>Server Error</h1></div>\r\n<div id=\"content\">\r\n <div class=\"content-container\"><fieldset>\r\n  <h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>\r\n  <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>\r\n </fieldset></div>\r\n</div>\r\n</body>\r\n</html>\r\n",
        "innerError": {
            "date": "2020-10-08T17:48:38",
            "request-id": "7989b12e-4276-4600-968a-daa59677ebfe",
            "client-request-id": "019b2755-0eb0-40f2-7ada-6df8d36857ff"
        }
    }
}

Yes – I know something is wrong but I thought I was doing everything properly. The account I am using is a personal account.

Other requests, such as https://graph.microsoft.com/beta/me work just fine. I have not found in the documentation any obvious things I am missing, so I thought I'd try to hear if someone has had a similar issue.

0

There are 0 best solutions below