Skip to content

Instantly share code, notes, and snippets.

Google Actions API

An implementation of the Google Actions API for node-red. Implements SYNC, QUERY, EXECUTE, and REQUEST_SYNC.

Heavily based on the sample node.js implementation here.

Usage

  1. Ensure that the OAuth 2 for Google Actions flows have been put in place. This endpoint will verify the bearer token for requests against the token stores in that flow.
  2. Paste into a new flow.
@i8beef
i8beef / Node-Red OAuth2 For Google Actions.md
Last active July 30, 2018 18:37
Google Actions OAuth Flow

OAuth 2 Authorization Code Flow For Use With Google Actions

This flow provides a "fake" OAuth 2 implementation for use with the Google Actions API.

Exposes three endpoints:

  1. /google/oauth-auth - Main auth endpoint that Google will call to initialize an OAuth 2 handshake. Checks "client" and "client secret", and returns a login form.
  2. /google/oauth-login - Processes login form, verifies "auth key" provided and generates a new OAuth auth code that the caller (Google) can then exchange for a real OAuth 2 ticket via the last endpoint.
  3. /google/oauth-token - Allows the caller to exchange an "auth key" for a valid OAuth 2 token, or request a new token via refresh token.
@Heshyo
Heshyo / cordova.js
Created July 2, 2015 07:32
Fires "deviceready" when we're not inside a Cordova app
// Fakes the call of "deviceready". This can be useful for test purposes, but potentially also for the real website
// to avoid things like:
// if inside the app, call this method inside "deviceready"
// else call this method now.
(function () {
var oldAddEventListener = document.addEventListener;
document.addEventListener = function (eventName, callback) {
if (eventName === "deviceready") {
callback();