{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/124","repository_url":"https://api.github.com/repos/Microsoft/BotBuilder","labels_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/124/comments","events_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/124/events","html_url":"https://github.com/Microsoft/BotBuilder/issues/124","id":148865724,"number":124,"title":"SetUserDataAsync throws a \"MissingProperty\" error","user":{"login":"jakobpn","id":13109307,"avatar_url":"https://avatars.githubusercontent.com/u/13109307?v=3","gravatar_id":"","url":"https://api.github.com/users/jakobpn","html_url":"https://github.com/jakobpn","followers_url":"https://api.github.com/users/jakobpn/followers","following_url":"https://api.github.com/users/jakobpn/following{/other_user}","gists_url":"https://api.github.com/users/jakobpn/gists{/gist_id}","starred_url":"https://api.github.com/users/jakobpn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakobpn/subscriptions","organizations_url":"https://api.github.com/users/jakobpn/orgs","repos_url":"https://api.github.com/users/jakobpn/repos","events_url":"https://api.github.com/users/jakobpn/events{/privacy}","received_events_url":"https://api.github.com/users/jakobpn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/BotBuilder/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"willportnoy","id":17912714,"avatar_url":"https://avatars.githubusercontent.com/u/17912714?v=3","gravatar_id":"","url":"https://api.github.com/users/willportnoy","html_url":"https://github.com/willportnoy","followers_url":"https://api.github.com/users/willportnoy/followers","following_url":"https://api.github.com/users/willportnoy/following{/other_user}","gists_url":"https://api.github.com/users/willportnoy/gists{/gist_id}","starred_url":"https://api.github.com/users/willportnoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willportnoy/subscriptions","organizations_url":"https://api.github.com/users/willportnoy/orgs","repos_url":"https://api.github.com/users/willportnoy/repos","events_url":"https://api.github.com/users/willportnoy/events{/privacy}","received_events_url":"https://api.github.com/users/willportnoy/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-04-16T16:02:42Z","updated_at":"2016-04-18T16:27:31Z","closed_at":null,"body":"I'm working on adding authentication to a basic bot using code from Jeff Hollan's VSTS Bot sample (https://github.com/jeffhollan/BotFrameworkSample).\r\n\r\nMy login controller is using SetUserDataAsync to save the access token for the user.\r\n\r\n```\r\n                var client = new ConnectorClient(Constants.botId, Constants.botSecret);\r\n                BotData getData;\r\n                try\r\n                {\r\n                    getData = await client.Bots.GetUserDataAsync(Constants.botId, userid);\r\n                }\r\n                catch\r\n                {\r\n                    getData = new BotData();\r\n                }\r\n                getData.Data = ar.Serialize();\r\n                await client.Bots.SetUserDataAsync(Constants.botId, userid, getData); \r\n```\r\n\r\nUnfortunately, the SetUserDataAsync method throws a \"MissingProperty\" error.\r\n\r\nI'm running the bot locally and I am talking to it through the Bot emulator.\r\n\r\nHere is the request that is sent to the Bot service:\r\n\r\nPOST https://api.botframework.com/bot/v1.0/bots/{removed}Bot/users/2c1c7fa3 HTTP/1.1\r\nOcp-Apim-Subscription-Key: {removed}\r\nAuthorization: Basic {removed}\r\nUser-Agent: Microsoft.Bot.Connector.ConnectorClient/1.0.0.0\r\nContent-Type: application/json; charset=utf-8\r\nHost: api.botframework.com\r\nContent-Length: 3823\r\nExpect: 100-continue\r\n\r\n{\r\n  \"data\": \"{\\\"AccessToken\\\":\\\"{removed}}\"\r\n}\r\n\r\nThis is the response from the service:\r\n\r\nHTTP/1.1 400 Bad Request\r\nCache-Control: no-cache\r\nPragma: no-cache\r\nContent-Length: 144\r\nContent-Type: application/json; charset=utf-8\r\nExpires: -1\r\nX-Content-Type-Options: nosniff\r\nSet-Cookie: ARRAffinity={removed};Path=/;Domain=bc-api.trafficmanager.net\r\nX-Powered-By: ASP.NET\r\nDate: Sat, 16 Apr 2016 15:48:57 GMT\r\n\r\n{\r\n  \"error\": {\r\n    \"code\": \"MissingProperty\",\r\n    \"message\": \"You have to specificy userId or conversationId\",\r\n    \"statusCode\": 400\r\n  }\r\n}\r\n\r\nAnd here is the exception:\r\n\r\n{\r\n  \"message\": \"An error has occurred.\",\r\n  \"exceptionMessage\": \"You have to specificy userId or conversationId\",\r\n  \"exceptionType\": \"Microsoft.Rest.HttpOperationException\",\r\n  \"stackTrace\": \"   at Microsoft.Bot.Connector.ErrorHandling.HandleError[ObjectT](HttpOperationResponse`1 result)\\r\\n   at Microsoft.Bot.Connector.BotsExtensions.<SetUserDataAsync>d__3.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\\r\\n   at Bot_Application1.LoginController.<Authorize>d__1.MoveNext() in C:\\\\Users\\\\jakobpn\\\\Scratch\\\\Bot Application1\\\\Bot Application1\\\\Controllers\\\\LoginController.cs:line 49\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()\"\r\n}\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/comments/211457644","html_url":"https://github.com/Microsoft/BotBuilder/issues/124#issuecomment-211457644","issue_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/124","id":211457644,"user":{"login":"willportnoy","id":17912714,"avatar_url":"https://avatars.githubusercontent.com/u/17912714?v=3","gravatar_id":"","url":"https://api.github.com/users/willportnoy","html_url":"https://github.com/willportnoy","followers_url":"https://api.github.com/users/willportnoy/followers","following_url":"https://api.github.com/users/willportnoy/following{/other_user}","gists_url":"https://api.github.com/users/willportnoy/gists{/gist_id}","starred_url":"https://api.github.com/users/willportnoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willportnoy/subscriptions","organizations_url":"https://api.github.com/users/willportnoy/orgs","repos_url":"https://api.github.com/users/willportnoy/repos","events_url":"https://api.github.com/users/willportnoy/events{/privacy}","received_events_url":"https://api.github.com/users/willportnoy/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T16:27:31Z","updated_at":"2016-04-18T16:27:31Z","body":"Does your userid passed to GetUserDataAsync/SetUserDataAsync have a non-null value?"}}