Gmail联系api访问错误

时间:2014-12-18 11:50:09

标签: javascript ssl https google-oauth google-contacts

我希望使用gmail api访问客户端gmail联系人。但它会给出错误,例如" Uncaught SecurityError:阻止了一个带有原点的框架" http://"从访问带有起源的框架" https://accounts.google.com"。请求访问的帧具有http"的协议,正在访问的帧。 我的代码

<html>
<head>
    <script src="https://apis.google.com/js/client.js"></script>
    <script src="jquery-2.1.1.min.js"></script>
    <script>
        function auth() {
            var config = {
                'client_id': 'ID',
                'scope': 'https://www.google.com/m8/feeds'
            };
            gapi.auth.authorize(config, function() {
                fetch(gapi.auth.getToken());
            });
        }
        function fetch(token) {
            $.ajax({
                url: 'https://www.google.com/m8/feeds/contacts/default/full?alt=json',
                dataType: 'jsonp',
                data: token
            }).done(function(data) {
                console.log(JSON.stringify(data));
            });
        }
    </script>
</head>

<body>
    <button onclick="auth();">GET CONTACTS FEED</button>
</body>

0 个答案:

没有答案
相关问题