簡體   English   中英

我網站上的 Discord 登錄不起作用。 為什么?

[英]Discord login on my website is not working. Why?

我想在網站上實現 Discord 登錄。 但我有幾個問題。 當我在終端中使用node oauth.js啟動應用程序時,沒有彈出錯誤。 但是,當我在 Discord 網站上單擊授權時,會彈出以下錯誤:

 TypeError: fetch is not a function
    at ...\oauth.js:49:5
    at Layer.handle [as handle_request] (...\node_modules\express\lib\router\layer.js:95:5)
    at next (...\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (...\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (...\node_modules\express\lib\router\layer.js:95:5)
    at ...\node_modules\express\lib\router\index.js:281:22
    at Function.process_params (...\node_modules\express\lib\router\index.js:335:12)
    at next (...\node_modules\express\lib\router\index.js:275:10)
    at ...\node_modules\body-parser\lib\read.js:130:5
    at invokeCallback (...\node_modules\raw-body\index.js:224:16)

我在我的代碼中找不到錯誤...這與fetch

我的代碼

有任何想法嗎?

通過查看小提琴,除了您格式化fetch導入的方式之外,我看不出任何問題。

const fetch = require('node-fetch');

嘗試類似的東西而不是導入它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM