Below is the code taken from Arun Nagarajan's Example: I am tried the same code to check.. But Its not installing properly. (I removed my redirect url, client id and secret in the below). Please tell me what wrong in the below code.

```
var AUTHORIZE_URL = 'https://accounts.google.com/o/oauth2/auth';
var TOKEN_URL = 'https://accounts.google.com/o/oauth2/token';
var REDIRECT_URL =             'exec';
var tokenPropertyName = 'GOOGLE_OAUTH_TOKEN';

var CLIENT_ID = '';
var CLIENT_SECRET = '';

function doGet(e) {
var HTMLToOutput;

if(e.parameters.state){
var state = JSON.parse(e.parameters.state);
if(state.action === 'çreate'){
var meetingURL = createMeetingNotes();
HTMLToOutput = '<html><h1>Meeting notes document created!</h1><a href="'+meetingURL+'">    <click here to open</a></html>';
}
else if (state.ids){
var doc = DocsList.getFileById(state.ids[0]);
var url = doc.getContentAsString();
HTMLToOutput = '"<html><a href="' +url+'"</a></html>"';
}
else {
zipAndSend(state.ecportIds.Session.getEffectUser().getEmail());
HTMLToOutput = '"<html><h1>Email sent. Check your Inbox.</h1></html>"';
}
}
else if(e.parameters.code){
getAndStoreAccessToken(e.parameters.code);
HTMLToOutput = '<html><h1>App is installed. You can close this window now or navigate to your </h1><a href="https://drive.google.com/">Google Drive</a></html>';
}
else {
HTMLToOutput = '<html><h1>Install this App into your google drive </h1><a href="' + getURLForAuthorization() + '">Click here to start install</a></html>';
}

return HtmlService.createHtmlOutput(HTMLToOutput);

}

function getURLForAuthorization() {
return  AUTHORIZE_URL + '?response_type=code&client_id=' + CLIENT_ID + '&redirect_uri='     + REDIRECT_URL + '&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.install+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email';
}

function getAndStoreAccessToken(code) {
var parameters = { method : 'post',
                  payload : 'client_id='+ CLIENT_ID + '&client_secret=' + CLIENT_SECRET + '&grant_type=authorization.code&redirect_uri=' + REDIRECT_URL};
var response = UrlFetchApp.fetch(TOKEN_URL.parameters).getContentText();
var tokenResponse = JSON.parse(response);
UserProperties.getProperty(tokenPropertyName, tokenResponse.access_token);
}

function getUrlFetchOptions() {
return {'contentType' : 'application/json',
        'headers' : {'Authorization': 'Bearer ' +         UserProperties.getProperty(tokenPropertyName),
                     'Accept' : 'application/json'}};           

}

function IsTokenValid() {
return UserProperties.getProperty(tokenPropertyName);
}

```

The error showing is: Bad request:undefined

I think the error is inside the function called : getAndStoreAccessToken.

```
var parameters = { method : 'post',
payload : 'client_id='+ CLIENT_ID + '&client_secret=' + CLIENT_SECRET + '&grant_type=authorization.code&redirect_uri=' + REDIRECT_URL};

```

Please tell me the correct url format for payload.