1
我試圖連接到域配置文件,但沒有爲此的Javascript庫。嘗試使用JavaJascript連接到Google Profiles API(域的聯繫人)
我試過這麼多的東西,只是不能得到它的工作。
var xhr = new XMLHttpRequest();
var oauthToken = gapi.auth.getToken();
xhr.open('GET',
'https://www.google.com/m8/feeds/profiles/domain/ditotest.com/full');
xhr.setRequestHeader('Authorization','Bearer ' + oauthToken.access_token);
xhr.setRequestHeader('Gdata-version', '3.0');
xhr.send(null);
console.log(xhr.status);
此錯誤:
Uncaught Error: InvalidStateError: DOM Exception 11 index.html:102
OPTIONS https://www.google.com/m8/feeds/profiles/domain/ditotest.com/full 405 (Method Not Allowed) index.html:100
XMLHttpRequest cannot load https://www.google.com/m8/feeds/profiles/domain/ditotest.com/full. Origin https://googledrive.com is not allowed by Access-Control-Allow-Origin. index.html:1
任何幫助,將不勝感激!