8 Replies Latest reply on Aug 22, 2016 1:58 PM by jliano

    Make authenticated Jive Call from jive-sdk

    jliano

      Ryan Rutan Aron Racho - I'm hoping you guys can help with this wall I'm bumping into.

       

      I'm using the latest node jive-sdk to create a very simple custom view tile. I want to display some content in that tile pulled from the Jive community the tile is deployed in. I've got the main configuration working and deploying the tile.

       

      The call I'm making from my node service to obtain data is done via the jive.community.doRequest() method.

       

      jive.community.doRequest(community, {
              path: '/api/core/v3/contents?abridged=true'
            })
      

       

      At the moment this request is done as an anonymous user, and I'd like for it to be done as the integration user created for this Add-on.

       

      Now, I've done the following:

       

      1. Signed the URL - I've taken the UUID and gone through the steps of signing it on the Jive console (Using Jive Cloud and I'm full admin)

      2. included the integrationUser object in the definition.json file for the Tile and re-uploaded it to the Jive instance.

       

      Unlike other add-ons, I don't see the warning in the page that the tile has Full-Access which is something that I would expect.

      The top is my custom add-on. I would expect the Full Access warning like the Jive integration platform.

       

      Screen Shot 2016-08-12 at 8.07.54 AM.png

       

      Also, if I provide an invalid jiveServiceSignature nothing happens, the add-on continues working. I'm clearly missing something that is preventing my add-on from acting with the system privileges. Also, if I log into the admin console, I don't see a permissions override for that user to be granted full access, nor can I manually select that user to create a permission's override.

       

      Thanks in advance!

       

       

      FYI cc: Wes Goldstein Carlo Saggese

        • Re: Make authenticated Jive Call from jive-sdk

          So question, can you confirm in your /db/community.json in fact has an integration token/refreshToken and other Oauth details for your jiveInstance.

           

          From what you say, it sounds like you've done everything correctly.

           

          One suggestion, the SDK may be erasing your signature if it isn't persisted in the jiveclientconfiguration.json - Definition file. 

           

          Did you happen to edit /extension_src/definition.json directly?  Can you confirm if your signature is still there?

           

          My suspicion is that the build process overwrote your setting on build because it may not have been in the jiveclientconfiguration.json.  I"ll go back to the community documentation Core V3 API - Run-As Feature & Signed Add-Ons and make sure that is clearly stated, just in case.

           

          Let us know.  Hope that helps.

            • Re: Make authenticated Jive Call from jive-sdk
              jliano

              Thanks for the prompt response Ryan.

               

              The /db/community.json doesn't have any token/refreshToken or OAuth attributes in it. It only has jiveUrl, version, tenantId, clientId, clientSecret, jiveCommunity.

               

              The signature is actually not on the jiveclientconfiguration.json file as the documentation states and mentions only the definition.json file. May be a miscommunication. I will try it there and let you know.

               

              Thanks,

               

              Jorge.

                • Re: Make authenticated Jive Call from jive-sdk

                  So I updated the documentation just recently to clarify.

                   

                  The document Core V3 API - Run-As Feature & Signed Add-Ons talks about the platform in general (sans tooling).

                   

                  When you are using the Jive SDK (Node.js) the definition.json file is auto-generated based on the SDK project.  Which means that the definition.json gets re-built every time the project runs.  This means that if you edited your definition.json manually via (/extension_src/definition.json) it would have been overwritten.  The jiveclientconfiguration.json - Definition tells you where in your jiveclientconfiguration.json file you should put the signature so it will get placed in the proper location.

                   

                  Hope that helps.

                   

                  RR

                  1 person found this helpful
                    • Re: Make authenticated Jive Call from jive-sdk
                      jliano

                      Thanks Ryan.

                       

                      There was some confusion on which definition.json file we were referring to. You mentioned the /extension_src/definition.json and I was talking about the file in the /tiles/teaser-tile/definition.json (teaser-tile being my custom tile). For some reason one of the documents I was referencing indicated that the 'integrationUser' object with the jiveSignature should go here.

                       

                      Based on your response, I moved it to the jiveclientconfiguration.json inside the 'extensionInfo' object and it is now included in the /extension_src/definition.json when building the extension and I can see that the Add-On loads with the "Full Access" label.

                       

                      Thanks for getting me through that. I redeployed the plugin, but I still don't see any token or OAuth information in the /db/community.json Do you suggest completely removing the addon? or is there some other manual coding I have to make in order for this to occur?

                       

                      Thanks!

                        • Re: Make authenticated Jive Call from jive-sdk

                          Yes, I'd re-install and/or Click on the "gear" box icon to the right of your Add-On and select "Reconnect to Service" ... as long you are specified a "register_url" in your meta.json you should be good to go.  Jive already thinks it should be sending you the credentials...so just need to catch the request when it is made. =)

                           

                          Sorry for the confusion. =)

                          1 person found this helpful
                            • Re: Make authenticated Jive Call from jive-sdk
                              jliano

                              Hi Ryan,

                               

                              Thanks for your help. That ended up working and I'm able to make the calls I need as a System User.

                               

                              One other question, is there a standard way of including the Jive CSS in a custom view tile so I can leverage the look and feel?

                               

                              Thanks!

                                • Re: Make authenticated Jive Call from jive-sdk

                                  CSS in a custom view should be straight forward.  One thing to note though:

                                  <link rel="stylesheet" href="stylesheets/main.css" type="text/css" media="screen" />

                                   

                                  Be sure to use relative URLs for directories equal to (or a sub-directory) to the HTML file in your add-on.  Same goes or Javascript.  Note above that the canvas.html is located below the stylesheets/ directory.  Do not use ./ prefixes as this changes the nature in which the browser resolves the domain.

                                   

                                  One other note I've seen in some browsers, be sure to include the type="text/css" attribute to make sure the app proxy service identifies it as such and lets the request through.

                                   

                                  That should be it though...hope that helps =)

                                  1 person found this helpful