System.UnauthorizedAccessException in SharePoint Online Workflow Using REST Web Service Call

A SharePoint Online workflow was giving me trouble a couple of days ago. I was attempting to use the web service call within a list workflow to get specific User Profile properties and set them on list items (the post is here). The workflow kept failing and returning this response:

{“odata.error”:{“code”:”-2147024891, System.UnauthorizedAccessException”,”message”:{“lang”:”en-US”,”value”:”Access denied. You do not have permission to perform this action or access this resource.”}}}

After a mild amount of frustration, searching, and testing various methods, I found the solution. The solution is outlined in full detail at http://msdn.microsoft.com/en-us/library/jj822159.aspx, but I originally found it through http://www.fabiangwilliams.com/2013/09/08/actually-resolved-unable-to-create-list-using-sharepoint-2013-rest-api-in-spd2013/.

The workflow finally completed after following all of the steps in the MSDN article above.