Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome app Picasa identity: OAuth2 request failed: Service responded with error: 'bad client id: {0}'

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?

like image 334
Dmitrii Sorin Avatar asked Feb 09 '14 18:02

Dmitrii Sorin


3 Answers

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.

like image 54
Shih-Wen Su Avatar answered Sep 21 '22 19:09

Shih-Wen Su


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.

like image 21
Dmitrii Sorin Avatar answered Sep 19 '22 19:09

Dmitrii Sorin


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

like image 44
breno Avatar answered Sep 17 '22 19:09

breno