【发布时间】:2020-10-31 02:48:19
【问题描述】:
Deno.js 中是否有一些用于 Google OAuth 的库或模块?我正在尝试在我的网络应用程序上实现 google 登录,并使用这个 google 帐户在 deno.js 中上传 youtube 视频。
感谢您的帮助!
【问题讨论】:
标签: javascript oauth deno
Deno.js 中是否有一些用于 Google OAuth 的库或模块?我正在尝试在我的网络应用程序上实现 google 登录,并使用这个 google 帐户在 deno.js 中上传 youtube 视频。
感谢您的帮助!
【问题讨论】:
标签: javascript oauth deno
我认为 OAuth 的通用解决方案尚不存在。不过,如果可以覆盖默认实现,可以试试authlete_deno_fen_oauth_server第三方模块。
有一个generic oauth2 module,但目前不可用。
如果上述选项不起作用,请尝试在 deno 中使用 npm 模块,如 this stackoverflow thread 中所述,并按照 this medium article 来实现您的目标。
【讨论】:
看看youtube-deno。我自己没用过,但它似乎提供了一个很好的接口,可以通过 deno 与 Youtube API 进行通信。
这是自述文件中的一个示例:
// A simple example to call the search_list() function and log the response json.
import { YouTube } from "https://x.nest.land/youtube-deno@0.0.6/mod.ts";
let obj = new YouTube("your-api-key-here", false);
obj.search_list({part: "snippet", q: "the coding train"}).then(function(response){
console.log(response);
});
【讨论】:
模块deno-oauth2-client 运行良好,体积小,易于使用。
另一个库 Dashport 旨在类似于 Deno 的 Passport.js。我在使用他们的示例代码时遇到了一些问题,因此我将a fork of Dashport 放在这里,并进行了一些修复和一些示例代码。
我为 Deno 中的这些 OAuth2 库整理了几个示例:
【讨论】: