2017-01-22 2 views
0

Google 융합 표 REST API https://developers.google.com/fusiontables/docs/v2/using에서 제공하는 설명서를 사용하여 융합 표를 만들려고합니다. 나는 다음과 같은 형식Google OAuth2를 사용하여 융합 표 생성을위한 Ajax 게시 요청을 올바르게 보내는 방법은 무엇입니까?

$.ajax({ type: "POST", crossDomain: true, contentType: "application/json", url: "https://www.googleapis.com/fusiontables/v2/tables", beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", token); }, data: { access_token: token, "name": "Insects", "columns": [ { "name": "Species", "type": "STRING" }, { "name": "Elevation", "type": "NUMBER" }, { "name": "Year", "type": "DATETIME" } ], "description": "Insect Tracking Information.", "isExportable": true }, async: false, success: function(result){ alert(result); }, error: function(result) { alert('error'); } });

에서 아약스 요청을 보내고하지만 401 오류를 얻고있다. 나는 인증 헤더에 토큰하지만 여전히 success.Any 포인터가 훨씬 appreciated.Thank 당신에게 수 없습니다, 무기명 설정을 시도

나는 내 문제를 해결

답변

0

:

xhr.setRequestHeader("Authorization", "Bearer "+ token);