简体   繁体   English

Google Script Oauth v1.0 REST API 访问

[英]Google Script Oauth v1.0 REST API access

I need a way to access a Oauth v1.0 rest API form inside google script.我需要一种方法来访问谷歌脚本中的 Oauth v1.0 rest API 表单。 google apps script .谷歌应用程序脚本

I found this page It says that the Library was sunset in 2015. I tried to add it.我发现这个页面它说图书馆在 2015 年日落。我试图添加它。 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.异常:ScriptError 异常:脚本正在使用已关闭的 OAuthConfig。 Learn more at https://cloud.google.com/blog/changes-oauth-apps-script [ { function: 'test', lineNumber: 80 } ]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 .我正在尝试访问Gravity Forms 中的数据。

They are using Oauth v1.0.他们正在使用 Oauth v1.0。

I'm able to access the data fine using Postman / Oauth v1.0.我可以使用 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?任何人都可以指出我正确的方向以使 Oauth v1.0 正常工作吗? Possibly a fully JS option?可能是一个完整的 JS 选项?

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. URL Fetch 服务的 OAuthConfig 类提供了一种简单的机制来连接到使用 OAuth 的 API,特别是 OAuth 1.0 和 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.此机制已于 2015 年 7 月 6 日停用。创建了用于 Apps 脚本的开源库 OAuth1 作为替代,此页面将演示如何更新您的脚本以使用此新机制。

  • The mechanism that was sunset was UrlFetchApp 's addOauthService method(Class OAuthConfig ).UrlFetchApp的机制是UrlFetchAppaddOauthService方法(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.警告:Google 的 OAuth 1.0 支持已于 2012 年弃用,并计划于 2015 年 4 月 20 日关闭。使用 OAuthConfig 连接到 Google API 的脚本应改为使用 OAuth2 for Apps 脚本库。

  • 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此关闭是指 Google 自己对 Google apis 的 oauth 1.0 支持,例如 Google maps api 或 Google drive api,并不指所有第三方 apis

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM