AnsweredAssumed Answered

Javascript (Google Apps) and REST

Question asked by cdeville on Dec 15, 2016
Latest reply on Jan 26, 2017 by fp0044417

I'm experimenting with Google Apps Script and hitting some roadblocks.

Been trying to piece this together through a number of tutorials on community.blackboard.com and the Google Developers documentation with no luck.

 

Just trying to get the authorization "post" to work. I try using this line:

 

UrlFetchApp.fetch(FullUrlAuth,Options);

where Options is

var AuthPayload =   'data=grant_type:client_credentials auth=mykey:mysecret';


var Options = {

  'method' : 'post',

  'muteHttpExceptions' : true,

  'payload' : AuthPayload

};

The URL seems to be accepted, but  I get back an error that I assume means I'm not sending the options in the correct format:

 

[16-12-15 14:59:52:362 PST] {"status":400,"message":"Required String parameter 'grant_type' is not present","extraInfo":"7ec799de3d1c46ae9f948a58e147c2ab"}

 

That "extra info" looks like my token, though. So something went right, but it just doesn't like the format I'm delivering grant_type in? Any help would be appreciated.

Outcomes