0

I am currently developing a chrome extension, and it requires OAuth 2.0 authentication. I am writing the extension (NOT an app) in JavaScript and my code for authentication looks like this:

gapi.client.setApiKey('AIzaSyDUDozQF2xXJd7nybrEhVYgWUsSA4BREWw');
        gapi.client.load('youtube', 'v3', function(){
            console.log("LOADED");
            gapi.auth.authorize({
                client_id: "323168009404-njonv6p9tt1d61pa9r2lnpaj18vf1n76.apps.googleusercontent.com",
                immediate: false,
                scope: "https://www.googleapis.com/auth/youtube.force-ssl"
            }, function(){
                console.log("AUTHORIZED");
                for(var k = 0; k < booksID.length; k++){
                    addToPlaylist(booksID[k], undefined, undefined);
                }
                console.log("FINISHED");
                var request = gapi.client.youtube.playlists.list({
                    part: 'snippet',
                    resource: {
                        forUsername: 'username'
                    }
                });
            });
        });

It prints out the "LOADED" statement to the console, but once it reaches the gapi.auth.authorize call, it never executes the callback function, signalling that authentication failed, while at the same time, in the supposed authentication window, I get this error:

enter image description here

I've tried searching the error on google and I can't seem to find a solution. The only solutions that come close are when the origin value in the authentication error report is some sort of IP address. Any help would be greatly appreciated.

By the way, I am trying to access the Youtube Data API.

Bob
  • 166
  • 3
  • 15
  • Check this: http://stackoverflow.com/questions/16850350/got-origin-mismatch-error-in-google-share-api – abielita Mar 28 '16 at 08:04
  • That was the problem I mentioned in the post that said after googling, every other origin_mismatch problem I saw had to deal with people using actual web and IP addresses. However, I know my problem now. When I created my client ID key in the Google API console, I used the wrong application ID. I WAS using the ID I found in the chrome web store developer dashboard, but it turns out I was just supposed to use the ID from the chrome extensions list. But thanks for trying to help, I appreciate it :) – Bob Mar 28 '16 at 12:04

0 Answers0