{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/PowerBI-CSharp/issues/6","repository_url":"https://api.github.com/repos/Microsoft/PowerBI-CSharp","labels_url":"https://api.github.com/repos/Microsoft/PowerBI-CSharp/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/PowerBI-CSharp/issues/6/comments","events_url":"https://api.github.com/repos/Microsoft/PowerBI-CSharp/issues/6/events","html_url":"https://github.com/Microsoft/PowerBI-CSharp/issues/6","id":134074024,"number":6,"title":"unable to call API using service account","user":{"login":"back5576","id":3430790,"avatar_url":"https://avatars.githubusercontent.com/u/3430790?v=3","gravatar_id":"","url":"https://api.github.com/users/back5576","html_url":"https://github.com/back5576","followers_url":"https://api.github.com/users/back5576/followers","following_url":"https://api.github.com/users/back5576/following{/other_user}","gists_url":"https://api.github.com/users/back5576/gists{/gist_id}","starred_url":"https://api.github.com/users/back5576/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/back5576/subscriptions","organizations_url":"https://api.github.com/users/back5576/orgs","repos_url":"https://api.github.com/users/back5576/repos","events_url":"https://api.github.com/users/back5576/events{/privacy}","received_events_url":"https://api.github.com/users/back5576/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-16T19:24:09Z","updated_at":"2016-02-23T04:33:54Z","closed_at":null,"body":"Hi,\r\n\r\nI changed the web sample to use login directly instead of interactively using the following code\r\n\r\n`\r\n            string authority = String.Format(\"https://login.microsoftonline.com/{0}\", Properties.Settings.Default.TenantID);\r\n\r\n            AuthenticationContext authenticationContext = new AuthenticationContext(authority);\r\n\r\n            ClientCredential credential = new ClientCredential(clientId: Properties.Settings.Default.ClientID, clientSecret: Properties.Settings.Default.ClientSecretKey);\r\n\r\n            AuthenticationResult result = authenticationContext.AcquireToken(resource: \"https://analysis.windows.net/powerbi/api\", clientCredential: credential);\r\n`\r\nbased upon samples I found online. But when I run it I get a \"403 Forbidden\".  It does return a key, but listing datasets throws a WebException.\r\n\r\nI need it to run non-interactively because it is a scheduled refresh task.\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/PowerBI-CSharp/issues/comments/187521077","html_url":"https://github.com/Microsoft/PowerBI-CSharp/issues/6#issuecomment-187521077","issue_url":"https://api.github.com/repos/Microsoft/PowerBI-CSharp/issues/6","id":187521077,"user":{"login":"back5576","id":3430790,"avatar_url":"https://avatars.githubusercontent.com/u/3430790?v=3","gravatar_id":"","url":"https://api.github.com/users/back5576","html_url":"https://github.com/back5576","followers_url":"https://api.github.com/users/back5576/followers","following_url":"https://api.github.com/users/back5576/following{/other_user}","gists_url":"https://api.github.com/users/back5576/gists{/gist_id}","starred_url":"https://api.github.com/users/back5576/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/back5576/subscriptions","organizations_url":"https://api.github.com/users/back5576/orgs","repos_url":"https://api.github.com/users/back5576/repos","events_url":"https://api.github.com/users/back5576/events{/privacy}","received_events_url":"https://api.github.com/users/back5576/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T04:33:54Z","updated_at":"2016-02-23T04:33:54Z","body":"Sorry, just noticed that you presumably used UserCredential class rather than ClientCredential. I was hoping to have this work using a service account (clientid and client secret) rather than a username and password."}}