Skip to content

Instantly share code, notes, and snippets.

View dan1wang's full-sized avatar

Daniel Wang dan1wang

View GitHub Profile
@dan1wang
dan1wang / README.MD
Created May 31, 2018 16:08
Executing App Script functions in Firebase Cloud Functions

If you are using Firebase on a Spark (free) plan, you can only make outbound networking requests to Google services. Unfortunately, that does not include Web app deployed from App Script (script.google.com/macros/s/.../exec). (Stackoverflow #43330192)

This is a crude example showing how to execute Apps Script using the scripts.run method of Apps Script API.

In this example, the Firebase app does not store the user's OAuth id token, does not validate the access token (e.g. the access token is issued for your project, not someone else's), and does not store the refresh token (access token will expire 60min after issue if not refreshed). For production, these issues must be resolved.