A OAuth2 module to easily allow you to integrate your applications authentication with 3rd party IdPs. Returns user data with minimal code to help you create and manage users in your databases!
GNU General Public License v3.0
3
stars
1
forks
source link
[Bug] fetch not a function in Discord/Google.stopFlow #18
Describe the bug
0.1.43 - this.libs.fetch is not a function
Stack:
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: this.libs.fetch(...).this is not a function
at DiscordHandler.stopFlow (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\@tpcofficial\big-oauth2\providers\discord.js:45:18)
at C:\Users\Brendan\source\repos\big-oauth2-testing\express.js:74:41
at Layer.handle [as handle_request] (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\layer.js:95:5)
at C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\index.js:281:22
at Function.process_params (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\index.js:335:12)
at next (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\index.js:275:10)
at Function.handle (C:\Users\Brendan\source\repos\big-oauth2-testing\node_modules\express\lib\router\index.js:174:3)
discord.js:41-48
async stopFlow(flowResponse) {//Should receive the token, automatically and prepare it for the user - the token is not stored and this should return USER DATA only
if (!flowResponse || (!flowResponse.code || !flowResponse.access_token))
return false
if (flowResponse.accces_token && flowResponse.token_type == 'Bearer') {
await this.libs.fetch(`https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${json.accces_token}`)
.this(json => {return json})
} else {
Describe the bug 0.1.43 - this.libs.fetch is not a function
Stack:
discord.js:41-48
express.js:72-75
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.