1

So I'm building a Phonegap app and I need to access Youtube's Data API. I managed to access the simple API (The one that requires an API key) yet I'm having trouble connecting with OAuth.

I did everything the walkthrough guides told me to do, I have generated a Client ID for Web application from https://console.developers.google.com.

I'm using the auth.js file from their example at the google developers website

The main issue is that every time I try to log in, I get this error:

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

I tried clearing my cookies but to no avail. I run this on localhost with Visual Studio, maybe this has something to do with that?

Ivan Jovović
  • 5,238
  • 3
  • 29
  • 57
RonH
  • 357
  • 2
  • 14
  • Have you reviewed [this answer](http://stackoverflow.com/questions/20498831/refused-to-display-in-a-frame-because-it-set-x-frame-options-to-sameorigin) as it seems related? – camelCase Oct 27 '15 at 15:41
  • Hi camelCase, I was actually there before writing this post. They talk about adding &output=embed" to the URL. I'm not sure to which url I should append this to. – RonH Oct 27 '15 at 15:44
  • Append it to the url that you are trying to access on YouTube which is giving you the error. – camelCase Oct 27 '15 at 15:49

1 Answers1

1

Ok, so after spending some time on it I finally figured out what the problem was.

On https://console.developers.google.com when I created my OAuth 2.0 client ID there was the "Authorized JavaScript origins" field which I left blank. Since I was running it from my localhost, I added http://localhost:28299 to the list of safe origins and everything worked fine.

Of course this is just for the development phase.

RonH
  • 357
  • 2
  • 14