简体   繁体   中英

Google Cloud Print API: User credentials required

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);

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM