Skip to content

Commit

Permalink
fix: can not support http oauth
Browse files Browse the repository at this point in the history
- Use config to determine using http or https package
  • Loading branch information
Chinlinlee committed Oct 28, 2022
1 parent 1731024 commit 290b34d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/oauth/middleware/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@

const path = require("path");
const _ = require("lodash"); // eslint-disable-line @typescript-eslint/naming-convention
const https = require("https");
const http = require("http");
const url = require("url");
const querystring = require("querystring");
const { pluginsConfig } = require("../../config");
const oauthPlugin = pluginsConfig.oauth;

var https = undefined;
if (oauthPlugin.http === "https") {
https = require("https");
} else {
https = require("http");
}

// 透過OAuth驗證
// 參考 https://blog.yorkxin.org/posts/oauth2-6-bearer-token.html
// Server=https://github.com/pedroetb/node-oauth2-server-example
Expand Down

0 comments on commit 290b34d

Please sign in to comment.