Google Cloud Print API: User credentials required

我是研究僧i 提交于 2019-12-10 09:43:05

问题


I'm trying to use the Google Cloud Print library to get a list of the cloud printers available to the users, but when I do a request I get an error: "User credentials required"

This is how I send the request:

var request = require('request');

var options = {
    url: 'https://www.google.com/cloudprint/search',
    headers: {
            'X-CloudPrint-Proxy': 'APP_NAME',
            'Authorization': 'GoogleLogin auth=ACCESS_TOKEN_HERE'
    }
};

function callback(err, response, body) {
    console.log(err);
    console.log(response);
    console.log(body);
}

request(options, callback);

回答1:


In order to make this work (as there is no exact documentation).

Add https://www.googleapis.com/auth/cloudprint to the scope of the login procedure.




回答2:


If you look here: https://github.com/dpsm/android-print/blob/master/src/main/java/com/github/dpsm/android/print/GoogleCloudPrint.java

They want the Authorization to be Bearer ACCESS_TOKEN_HERE

instead of GoogleLogin auth=ACCESS_TOKEN_HERE



来源:https://stackoverflow.com/questions/26510838/google-cloud-print-api-user-credentials-required

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