GithubHelp home page GithubHelp logo

appsscript-api-auth0's Introduction

Apps Script Connection to External API using Auth0 Tokens

This is a demonstration of how you can have Google Apps Script connect to an external API that would accept a token generated by Auth0. This requires an Auth0 account as well as an API that will authorize requests that include an Auth0 token. This is using the Machine-to-Machine Auth0 method. Not exclusive to Auth0, this code can be adopted to be used with Firebase or a custom authentication server. It is only an example of using and refreshing tokens.

There are better ways of doing this, but in a pinch this has worked as a stable solution for me. This is unsafe for production use. In production I would use the gmail account used to log into the google app as the only way to authenticate with your API. That would add a bit more work in managing users and auth methods while this is a very general auth script.

It would be wise to make use of Google PropertiesService which enables you to store values by document or by user. There are many different ways to store properties and I would explore them all before deciding what is best practice for you. Exploring Apps Script Documentation will shed light on new ideas.

I have API functions triggered on an interval of every X minutes, but you can also setup a menu item that triggers a POST manually using SpreadsheetApp.getUi().createMenu

There are lots of ways you can make a Google Sheet look and function like a web based application. It can be an easy way of drafting up a mock before going into full development of a single page application. Using sidebars and dialogues with HTML/CSS further expands on what you can do. Apps Script is almost exactly the same as Javscript.

appsscript-api-auth0's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.