Saturday 22 April 2017

Google API oauth for devices returns { error: 'invalid_request' }

I'm attempting to authorize the google calender API for an Amazon Alexa skill, using the instructions listed here. I believe the process is a little different since the app is on a device with no screen and therefore has to be processed differently.

The POST request that I am making only returns { error: 'invalid_request' }, and I cannot figure out why. Here is my POST request (node)

var request = require('request');
request.post(
    'https://accounts.google.com/o/oauth2/device/code',
    { json: { 
        client_id: '51362933288-lfin0rvo7pu2frlcpc3oc5eqjofg0ns8.apps.googleusercontent.com', 
        scope: 'https://www.googleapis.com/auth/calendar'
    } },
    function (error, response, body) {
        if (!error && response.statusCode == 200) {
            console.log(body);
        } else {
            console.log("Error: "+error);
        }
    }
);

I've seen a bunch of other people who have issues and their requests include the client secret or redirect URI etc etc, but I haven't included these simply because I've just been trying to follow the instructions listed on the website i linked. Any insight as to what I'm doing wrong here? Thanks!



via mcheah

No comments:

Post a Comment