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

爷,独闯天下 提交于 2019-12-22 05:26:10

问题


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?


回答1:


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.




回答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.




回答3:


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



来源:https://stackoverflow.com/questions/21662966/chrome-app-picasa-identity-oauth2-request-failed-service-responded-with-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!