2015-11-16 35 views
0

我試圖在Electron應用程序中實現基本的JavaScript Code Samples。我已成功創建了我的項目並在Google Console中添加了API密鑰憑證。如何在Electron應用程序中使用YouTube API?

然而,當我嘗試的基本採樣到電子應用程序,我得到以下錯誤:

Refused to display ' https://accounts.google.com/o/oauth2/auth?client_id= ...' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

我應該怎麼做,以避免這種情況?

回答

0

有時客戶端ID可能是問題。 See Here

您還可以使用CORS如果不工作:

https://developers.google.com/api-client-library/javascript/features/cors

+0

我已經使用了 「Web客戶端」 客戶端ID。使用CORS解決方案,我在第一個示例中獲得了403,並且由於與問題相同的原因,我無法獲取訪問令牌,因此調用'authorize'失敗。 –

+0

我設置了一個[web項目](https://github.com/YannBertrand/YoutubeApiExample)並得到完全相同的問題。 –

+0

[Found it](http://stackoverflow.com/questions/24681594/google-api-400-bad-request-and-refused-to-display-in-a-frame-because-i) –

相關問題