Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Script Oauth v1.0 REST API access

I need a way to access a Oauth v1.0 rest API form inside google script. google apps script.

I found this page It says that the Library was sunset in 2015. I tried to add it. When I do I get an error that it's not supported anymore and my script refuses to run.

Error:

Exception: ScriptError Exception: Script is using OAuthConfig which has been shut down. Learn more at https://cloud.google.com/blog/changes-oauth-apps-script [ { function: 'test', lineNumber: 80 } ]

I need to access a external site to download some data. I'm trying to access the data in Gravity Forms.

They are using Oauth v1.0.

I'm able to access the data fine using Postman / Oauth v1.0. However I am unable to find a solution for google apps script.

Can anyone point me in the right direction to get Oauth v1.0 working? Possibly a fully JS option?

like image 751
Kent Avatar asked Sep 23 '20 07:09

Kent


1 Answers

The documentation says

The URL Fetch service's OAuthConfig class provided a simple mechanism for connecting to an API that utilized OAuth, specifically OAuth versions 1.0 and 1.0a. This mechanism was sunset on July 6, 2015. The open source library OAuth1 for Apps Script was created as a replacement, and this page will demonstrate how to update your scripts to use this new mechanism.

  • The mechanism that was sunset was UrlFetchApp's addOauthService method(Class OAuthConfig).

  • The replacement provided is a open source library here

  • This library is officially recommended and updated regularly.

Warning: Google's OAuth 1.0 support was deprecated in 2012 and is scheduled to be shut down on April 20, 2015. Scripts using OAuthConfig to connect to a Google API should instead use the OAuth2 for Apps Script library.

  • This shudown refers to Google's own oauth 1.0 support for Google apis, such as Google maps api or Google drive api and does NOT refer to all third party apis
like image 77
TheMaster Avatar answered Oct 22 '22 22:10

TheMaster