Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions google/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,31 @@
</script>

<script type="text/x-red" data-help-name="google calendar">
<p>Create an entry in a <a href="https://www.google.com/calendar">Google Calendar</a>.</p>
<p>Return the next event in a <a href="https://www.google.com/calendar">Google Calendar</a>.</p>
<p>The incoming message can provide the following properties:
<ul>
<li><b>payload</b> - an object containing the query parameters described in <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list">event list API documentation</a></li>
<li><b>calendar</b> - the calendar to add the event to (optional, defaults to the node calendar property or the users primary calendar)</li>
<li><b>payload</b> - a text search string used to select relevant events</li>
<li><b>calendar</b> - the calendar to retrieve the event from (optional, defaults to the node calendar property or the users primary calendar)</li>
</ul>
</p>
<p>The message sent from the node will have properties:
<ul>
<li><b>title</b> - the summary string from the calendar entry</li>
<li><b>description</b> - the description from the calendar entry</li>
<li><b>location.description</b> - the location string from the calendar entry</li>
<li><b>data</b> - the raw event from the google calendar query as described in the <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list">event list API documentation</a></li>
<li><b>payload</b> - an object containing:
<ul>
<li><b>title</b> - the summary string from the calendar entry</li>
<li><b>description</b> - the description from the calendar entry</li>
<li><b>location.description</b> - the location string from the calendar entry</li>
<li><b>start</b> - Javascript Date of start time - midnight for all day event</li>
<li><b>end</b> - Javascript Date of end time - midnight for all day event</li>
<li><b>allDayEvent</b> - true if event is an all day event</li>
<li><b>creator</b> - object containing name and email properties</li>
<li><b>attendees</b> - list of objects containing name and email properties</li>
</ul>
</li>
</ul>
</p>
</script>
Expand Down
8 changes: 3 additions & 5 deletions google/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ module.exports = function(RED) {

var csrfToken = crypto.randomBytes(18).toString('base64').replace(/\//g, '-').replace(/\+/g, '_');
credentials.csrfToken = csrfToken;
credentials.callback = callback;
res.cookie('csrf', csrfToken);
res.redirect(url.format({
protocol: 'https',
Expand Down Expand Up @@ -194,11 +195,7 @@ module.exports = function(RED) {
code: req.query.code,
client_id: credentials.clientId,
client_secret: credentials.clientSecret,
redirect_uri: url.format({
protocol: req.protocol,
host: req.headers.host,
pathname: RED.httpAdmin.path() + 'google-credentials/auth/callback'
}),
redirect_uri: credentials.callback
},
}, function(err, result, data) {
if (err) {
Expand All @@ -216,6 +213,7 @@ module.exports = function(RED) {
data.expires_in + (new Date().getTime()/1000);
credentials.tokenType = data.token_type;
delete credentials.csrfToken;
delete credentials.callback;
RED.nodes.addCredentials(node_id, credentials);
request.get({
url: 'https://www.googleapis.com/plus/v1/people/me',
Expand Down