Question

I'm trying to authorize with chrome.identity.getAuthToken() to get token for Picasa web service. I couldn't find Picasa API in Google Developer Console and set its scope to "https://picasaweb.google.com/data/" oauth2 part of manifest.json. Picasa docs say that I can skip this step.

chrome.identity.getAuthToken({
    interactive: true
}, function (token) {
    if (chrome.runtime.lastError) {
        console.error(chrome.runtime.lastError);
    } else {
        console.log(token);
    }
});

getAuthToken() always ends with an error "OAuth2 request failed: Service responded with error: 'bad client id: {0}'". If no scopes are set, the error looks like "OAuth2 request failed". Where have I mistaken?

Was it helpful?

Solution 2

It seems amazing but after 1 day has passed, everything is working :)

UPD: I've tried gdrive sample from chrome-app-samples repo and added scope for Picasa. After everything worked fine, I copied its key and oauth2 section to my app's manifest. Everything worked fine too. After this I deleted client_id for app in developer console and created it again. And after that everything was ok.

OTHER TIPS

Steps I take to make it work

  1. Go to Google Developers Console and create a new project.
  2. Go to APIs & auth > Credentials in the panel to create new Client ID. The application ID of chrome app can be obtained from Chrome Developer Dashboard if you your app is uploaded.
  3. Go to APIs & auth > Consent screen and fill in Email Address and Product Name and Save.

I didn't know step 3 was necessary.

You need to register your application in Google Developer Console and obtain a client_id. See the 'Credentials' pane to configure your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top