Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/466.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/130.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 通过gmail小工具获取salesforce数据_Javascript_Oauth_Gmail_Salesforce_Gmail Contextual Gadgets - Fatal编程技术网

Javascript 通过gmail小工具获取salesforce数据

Javascript 通过gmail小工具获取salesforce数据,javascript,oauth,gmail,salesforce,gmail-contextual-gadgets,Javascript,Oauth,Gmail,Salesforce,Gmail Contextual Gadgets,我正在尝试使用OAuth获取Gmail中的salesforce记录。我正在阅读有关上下文小工具的文章,但无法触发OAuth请求。 我可以看到我的所有javascript警报,但授权弹出窗口没有出现 欢迎提供任何帮助/提示 请查看以下代码以供参考: <?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="SF OAuth"> <Require featu

我正在尝试使用OAuth获取Gmail中的salesforce记录。我正在阅读有关上下文小工具的文章,但无法触发OAuth请求。 我可以看到我的所有javascript警报,但授权弹出窗口没有出现

欢迎提供任何帮助/提示

请查看以下代码以供参考:

<?xml version="1.0" encoding="UTF-8"?>
<Module>
  <ModulePrefs title="SF OAuth">


        <Require feature="dynamic-height"/>

    <Require feature="google.contentmatch">
      <Param name="extractors">
        google.com:SenderEmailExtractor
      </Param>
    </Require>

  </ModulePrefs>

  <Content type="html" view="card">
    <![CDATA[
      <!-- Start with Single Sign-On -->

      <script type="text/javascript" src="https://gist.github.com/Sujit1987/7672590/raw/86a330515eede7c169280718decc9de4ddb494fb/jquery.js"></script>
      <script type="text/javascript" src="https://gist.github.com/Sujit1987/7673430/raw/7e066e610cf98a16769c93f733efedb13fa4a5b5/jquery.popup.js"></script>
      <script type="text/javascript" src="https://gist.github.com/Sujit1987/7671399/raw/f175870455f7dfe41a3dffeef7ae605138810619/forcetk.js"></script>



      <script type="text/javascript">
        // OAuth Configuration
        var loginUrl    = 'https://login.salesforce.com/';
        var clientId    = '******';
        var redirectUri = 'https://gist.github.com/Sujit1987/7672925/raw/72a98f5a5cae641b20ad36841448f4edee6ec601/oauthcallback.html';
        var proxyUrl    = 'https://gist.github.com/Sujit1987/7671408/raw/ae3d9059a9fb032e0e231a8c54f00f076059f736/proxy.php?mode=native';

        var client = new forcetk.Client(clientId, loginUrl, proxyUrl);

        $(document).ready(function() {
        alert('Hello - Inside Ready function');


            $('#message').popupWindow({ 
                windowURL: getAuthorizeUrl(loginUrl, clientId, redirectUri),
                windowName: 'Connect',
                centerBrowser: 1,
                height:524, 
                width:675

            });

            $('#message').show();
             alert('Hello - Exiting Ready Function');
        }); 


        function getAuthorizeUrl(loginUrl, clientId, redirectUri){
        alert('Get Authorized Called'+loginUrl+'services/oauth2/authorize?display=popup'
                +'&response_type=token&client_id='+escape(clientId)
                +'&redirect_uri='+escape(redirectUri));


               return loginUrl+'services/oauth2/authorize?display=popup'
                +'&response_type=token&client_id='+escape(clientId)
                +'&redirect_uri='+escape(redirectUri);
        }

         function sessionCallback(oauthResponse) {
         alert('Hello - Session Call Back');
            if (typeof oauthResponse === 'undefined'
                || typeof oauthResponse['access_token'] === 'undefined') {
                $('#message').html('Error - unauthorized!');
            } else {
                client.setSessionToken(oauthResponse.access_token, null,
                    oauthResponse.instance_url);

                    client.query("SELECT Name FROM Account LIMIT 1", 
                      function(response){
                        $('#message').html('The first account I see is '
                          +response.records[0].Name);

                    });
            }
        }


        var clients = [];

        matches = google.contentmatch.getContentMatches();
            for(var match in matches)
            {
                for(var key in matches[match])
                {
                 if(key == 'sender_email')
                    {
                       clients.push(matches[match][key]);

                    }
                }  
            }

        /*gadgets.window.adjustHeight(100);*/

        /*function showEmail(){
          document.write(clients);
        }*/
      </script>
      <form>

     <!-- <button type="button" onclick="showEmail();"> Show Sender Email </button> 
      <button type = "button" onclick ="getAuthorizeUrl();"> Query SalesForce </button> -->
      <p id="message">Click here.</p>
      </form>

    ]]>
  </Content>
</Module>