내가 Google's developer tutorial
에서 샘플 예를 따르도록 노력하고 업데이트하여 크롬 (버전 38.0)gapi.auth 자바 스크립트 명령이 제대로
을 실행하지만 도달 결코 gapi.auth 기능처럼 보인다되지 않습니다 자신의 콜백 여기
그것을 증명하는 코드 예제 :
<!doctype html>
<html>
<head>
<title>Google API Client test</title>
</head>
<body>
here will be the use of Oauth 2.0
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
googleApiClientReady = function() {
window.setTimeout(checkAuth, 1);
}
function checkAuth() {
gapi.auth.authorize({
client_id: 'XXX',
scope: 'https://www.googleapis.com/auth/youtube',
immediate: true
}, handleAuthResult);
}
function handleAuthResult(authResult) {
if (authResult && !authResult.error) {
alert('gapi.auth return successfully');
} else {
alert('gapi.auth return with error');
}
}
</script>
<script src="https://apis.google.com/js/client.js?onload=googleApiClientReady"></script>
</body>
</html>
나는 위의 HTML을 실행 + JS는 'HandleAuthResult'의 2 옵션의 경고 없음 모든에서 화면 에 표시되는 파일 - 때 -이 기능이 'gapi.auth.authorize'
에 의해 다시 호출되지 않습니다 것을 의미한다누구든지이 라이브러리를 제대로 사용할 수 있습니까?
http://stackoverflow.com/questions/21710842/google-api-in-javascript – GyRo
감사합니다. 이것은 도움이되었다. 또한 웹 서버 (http 시작 URL)에서 html을 실행하고 파일 시스템을 통해 직접 실행하지 않은 경우에만 작동했습니다. – GyRo