3 Replies Latest reply on May 22, 2017 4:48 PM by Jonathan Block

    Can't detect the context of an app page

    Jonathan Block

      I'm developing a Jive app using an external server as middleware to display the appropriate app pages.  The display is initially proxied through Jive's servers, long enough to determine the correct context and current user, before redirecting to load subsequent pages directly from the remote server.  I have most of that mechanism working, but the context detection is coming up empty.

       

      Here's a slightly-sanitized version of my app.xml, which may well be overloaded for what I actually need:

      <?xml version="1.0" encoding="UTF-8"?> 

      <Module specificationVersion="1"> 

        <ModulePrefs title="Credentials" 

                     description="This app adds blah blah blah." 

                     author="Jonathan Block" 

                     author_affiliation="company" 

                     author_email="email"> 

          <!-- Commonly used features --> 

          <Require feature="dynamic-height" /> 

          <Require feature="jive-core-v3" /> 

          <Require feature="osapi"/> 

          <Require feature="settitle"/> 

          <Require feature="views" /> 

          <Require feature="opensocial" /> 

          <Require feature="opensocial-data" /> 

          <Require feature="setprefs" /> 

          <Optional feature="minimessage" /> 

          <Optional feature="locked-domain"/> 

          <Optional feature="oauthpopup"/> 

          <Optional feature="dynamic-width" /> 

          <Optional feature="embedded-experiences"/> 

          <Optional feature="selection"/> 

          <Optional feature="open-views"/> 

          <Optional feature="firebug-lite"/> 

          <Optional feature="content-rewrite"/>

          <Optional feature="actions"> 

            <Param name="action-contributions"> 

                <![CDATA[

                   <action id="reverse.domain.name.global"

                           path="jive/actions/content/*"

                           label="Credentials"

                           view="credentials"

                           icon="https://remote.host/public/images/icons/credentials/icon16.png" />

                   <action id="reverse.domain.name.profile"

                           path="jive/tabs/profile"

                           label="Credentials"

                           view="credentials"

                           icon="https://remote.host/public/images/icons/credentials/icon16.png" />

                ]]> 

            </Param> 

          </Optional> 

          <!-- Icons: 3 sizes, 16x16, 48x48, 128x128 --> 

          <Link rel="Icon"       href="https://remote.host/public/images/icons/credentials/icon16.png" /> 

          <Link rel="MediumIcon" href="https://remote.host/public/images/icons/credentials/icon48.png" /> 

          <Link rel="LargeIcon"  href="https://remote.host/public/images/icons/credentials/icon128.png" /> 

        </ModulePrefs> 

        <Content type="html" view="credentials,canvas" href="https://remote.host/path/to/credentials" preferred_height="500" /> 

      </Module> 

       

      Here's the content for the page that loads initially, which is proxied through Jive:

       

      <script type='text/javascript'>

        var page_type;

        var page_id;

       

        function detect() {

          osapi.jive.core.container.getLaunchContext(function (resp) {

            page_type = resp.jive.content.type;

            page_id = resp.jive.content.id;

            identify();

          });

        }

       

        function identify() {

          var payload = {

            'href': 'https://remote.host/path.json?page_type=' + page_type + '&page_id=' + page_id,

            'format': 'json',

            'authz': 'signed',

            'headers': {'content-type': ['application/json']}

          };

          osapi.http.get(payload).execute(

            function(response){

              document.location = response.content.url;

            }

          );

        }

       

        gadgets.util.registerOnLoadHandler(detect);

      </script>

      I can confirm that everything in this initial page is functional, except for the code inside the osapi.jive.core.container.getLaunchContext anonymous callback.  The resp variable is coming back as null.  I've been stabbing at this for a while now, and I just can't explain why that result would be empty.

       

      I'd appreciate any help you can offer.