我正在使用此应用程序作为我想要做的事情的基础。 https://github.com/sgshawnblanchard/CanvasNodeJS
我遇到的问题是,我认为我不太明白为了能够通过Canvas应用程序发布到Chatter摘要需要发生什么。我有一切正常,但在此页面上:https://github.com/sgshawnblanchard/CanvasNodeJS/blob/master/public/index.html
你会看到他正在发布一个“已签名的请求”,这里是我感到困惑的地方。我知道我需要发帖,这个价值会让salesforce知道我有权发布到Feed,但是我如何获得这个价值?在您看到的示例中。
<form action="canvas" method="post">
<input id="signed_request" name="signed_request" type="text" value="Pxy%2FPFsGb%2FfH1ORo%2B0vqdJjCi97Bypek0hzST8UIGzY%3D.eyJjb250ZXh0Ijp7InVzZXIiOnsibGFuZ3VhZ2UiOiJlbl9VUyIsInRpbWVab25lIjoiQW1lcmljYS9DaGljYWdvIiwibG9jYWxlIjoiZW5fVVMiLCJmdWxsTmFtZSI6IlNoYXduIEJsYW5jaGFyZCIsInVzZXJJZCI6IjAwNTQwMDAwMDAxQ3ppQ0FBUyIsInVzZXJUeXBlIjoiU1RBTkRBUkQiLCJ1c2VyTmFtZSI6InNoYXduX2JsYW5jaGFyZEBzY2h1bWFjaGVyZ3JvdXAuY29tLmNhbnZhcyIsImVtYWlsIjoic2hhd25fYmxhbmNoYXJkQHNjaHVtYWNoZXJncm91cC5jb20uY2FudmFzIiwicHJvZmlsZVBob3RvVXJsIjoiaHR0cHM6Ly9zZ2NvcnAtLWNhbnZhcy0tYy5jczE1LmNvbnRlbnQuZm9yY2UuY29tL3Byb2ZpbGVwaG90by83MjllMDAwMDAwMDAybm8vRiIsInByb2ZpbGVJZCI6IjAwZTMwMDAwMDAwaFFWMCIsImZpcnN0TmFtZSI6IlNoYXduIiwibGFzdE5hbWUiOiJCbGFuY2hhcmQiLCJhY2Nlc3NpYmlsaXR5TW9kZUVuYWJsZWQiOmZhbHNlLCJyb2xlSWQiOiIwMEU0MDAwMDAwMGtaU1kiLCJjdXJyZW5jeUlTT0NvZGUiOiJVU0QiLCJwcm9maWxlVGh1bWJ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0ZF9NNFpTMGc0dmJ1am4yS0Y3UjcwN3AweVI2TGI5ZUxLZDVzcVZxd2xUUnpTXzhySzVNNnpBVmZINWNrIn0sImlzc3VlZEF0IjpudWxsfQ%3D%3D" />
<input type="submit" value="submit"/>
</form>
我知道这个值包含在2个内容中,在http://www.salesforce.com/us/developer/docs/platform_connect/Content/canvas_app_signed_req_authentication.htm
中找到签名请求是以下连接的元素的字符串:
使用HMAC SHA-256算法加密的画布应用消费者密码A句点(“。”)
在Base64中编码的上下文和授权令牌JSON
签名的请求看起来与此类似,尽管它会很多 更长: 9Rpl6rE7R2bSNjoSfYdERk8nffmgtKQNhr5U / 5eSJPI = .eyJjb250ZXh0Ijp7InVzZXIiOnsibGFuZ3V ....
我知道如何从SalesForce设置中获取我的秘密,但是我不知道“在Base64中编码的上下文和授权令牌JSON”是什么意思
我认为我需要获取这些静态值并创建一个长字符串,就像开发人员在示例中所做的那样并将其发布,以及我想要发送给Chatter的任何消息,我是否正确?或者我错过了什么?
这是我观看过的另一个视频,不过这个家伙已经没时间了,也没有显示它是如何运作的https://www.youtube.com/watch?v=kcNBwOqj2qA
答案 0 :(得分:0)
原来是我没有正确完成的权限设置。不确定哪一个让我的应用程序失败,但是我只是在Salesforce应用程序预览沙箱上创建了一个Heroku应用程序,然后对它们开箱即用的设置进行了1比1的比较。这就行了。