RonH
RonH

Reputation: 357

Cannot connect to Youtube Data API V3 with javascript

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?

Upvotes: 1

Views: 311

Answers (1)

RonH
RonH

Reputation: 357

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.

Upvotes: 1

Related Questions