0
我想查看我的頻道視頻列表,並且出現了這個錯誤invalid_client
。無法訪問OAuth2 Youtube API V3
未找到OAuth客戶端。這意味着客戶端ID是錯誤的!
var OAUTH2_CLIENT_ID = '############';
var OAUTH2_SCOPES = ['https://www.googleapis.com/auth/youtube'];`
`googleApiClientReady = function() {
gapi.auth.init(function() {
window.setTimeout(checkAuth, 1);
});
}
function checkAuth() {
gapi.auth.authorize({
client_id: OAUTH2_CLIENT_ID,
scope: OAUTH2_SCOPES,
immediate: true
}, handleAuthResult);
}
function handleAuthResult(authResult) {
if (authResult && !authResult.error) {
$('.pre-auth').hide();
$('.post-auth').show();
loadAPIClientInterfaces();
} else {
$('#login-link').click(function() {
gapi.auth.authorize({
client_id: OAUTH2_CLIENT_ID,
scope: OAUTH2_SCOPES,
immediate: false
}, handleAuthResult);
});
}
}
function loadAPIClientInterfaces() {
gapi.client.load('youtube', 'v3', function() {
handleAPILoaded();
});
}
的console.google的截圖: