I am trying to log my users in using discord oauth2
I noticed, when clicking the authorize button multiple times, I am getting this error.
InternalOAuthError: Failed to fetch user's guilds
at S:\project\node_modules\passport-discord\lib\strategy.js:108:32
at passBackControl (S:\project\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage.<anonymous> (S:\project\node_modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
After that I also get this error, but idk if that is important:
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
I am using passport, passport-discord and express-session
Yes this is because of the rate limit that discord has. I do not know any solution for this beside changing you passport to keep track of the amount of request made to discord.
Related
I am using Nodejs server and it is deployed on g-cloud. I make a call to the vimeo API by using axios in my server. When I run the server locally, it runs fine. However, it gives a 403 error when the call is made by the deployed server.
The error seems like this:
Error: Request failed with status code 403\n at createError
(/workspace/node_modules/axios/lib/core/createError.js:16:15)\n at settle
(/workspace/node_modules/axios/lib/core/settle.js:17:12)\n at
IncomingMessage.
(/workspace/node_modules/axios/lib/adapters/http.js:312:11)\n at IncomingMessage.emit
(events.js:326:22)\n at endReadableNT (_stream_readable.js:1241:12)\n at
processTicksAndRejections (internal/process/task_queues.js:84:21)
Check if you are getting a 1020 error code.
Vimeo/Cloudflare may be blocking requests from google IP's to prevent bot attacks.
Reference
I am trying to make a web app in NodeJS, that uses passport to authenticate users. I've incorporated Soundcloud in my app on the front end, but would like to add soundcloud authenication in as well. I've tried many packages, and passport-soundcloud is the one that has seemed to work the best. However, somewhere along the line, and the stack trace won't tell me where (location in the passport-soundcloud code), I get this error:
TokenError
at Strategy.OAuth2Strategy.parseErrorResponse (/Users/marisusis/Documents/Repos/visualizer/node_modules/passport-oauth2/lib/strategy.js:329:12)
at Strategy.OAuth2Strategy._createOAuthError (/Users/marisusis/Documents/Repos/visualizer/node_modules/passport-oauth2/lib/strategy.js:376:16)
at /Users/marisusis/Documents/Repos/visualizer/node_modules/passport-oauth2/lib/strategy.js:166:45
at /Users/marisusis/Documents/Repos/visualizer/node_modules/oauth/lib/oauth2.js:177:18
at passBackControl (/Users/marisusis/Documents/Repos/visualizer/node_modules/oauth/lib/oauth2.js:123:9)
at IncomingMessage.<anonymous> (/Users/marisusis/Documents/Repos/visualizer/node_modules/oauth/lib/oauth2.js:143:7)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Any ideas on how to fix this, or an alternate package or method I could use?
I am using node-slack to use the Mattermost incoming URL Api for a self hosted mattermost. This mattermost is secured by lets-encrypt.
My node code is working with the slack api, and i have testet the send data with Postman (manual post tool) against the MM server.
In both cases it is working.
But with node i receive a unable to verify the first certificate error.
In "https://nodejs.org/api/https.html" I can see, that node.js is supporting a "well known" set of root CAs.
To simplify the question, I have written this small peace of code:
let request = require('request');
request("https:--letsencryptsecuredsite",function(err,body){
console.log(err);
console.log(body);
});
This results in
{ Error: unable to verify the first certificate
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1079:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:603:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:433:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }
What do i have to use an API on a lets encrypt secured server ?
I am using node version 6.9.2.
I am trying to implement login through google using passport google oauth2 strategy. But I am getting the following error. I searched for solutions but none of them worked for me.
TokenError: Code was already redeemed.
at Strategy.OAuth2Strategy.parseErrorResponse (/home/venkatesh/Documents/Web
Dev/Apps/myapps/user_auth_jwts/node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/lib/strategy.js:320:12)
at Strategy.OAuth2Strategy._createOAuthError (/home/venkatesh/Documents/Web
Dev/Apps/myapps/user_auth_jwts/node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/lib/strategy.js:367:16)
at /home/venkatesh/Documents/Web Dev/Apps/myapps/user_auth_jwts/node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/lib/strategy.js:166:45
at /home/venkatesh/Documents/Web Dev/Apps/myapps/user_auth_jwts/node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18
at passBackControl (/home/venkatesh/Documents/Web Dev/Apps/myapps/user_auth_jwts/node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:123:9)
at IncomingMessage. (/home/venkatesh/Documents/Web Dev/Apps/myapps/user_auth_jwts/node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:143:7)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:437:9)
at process._tickCallback (node.js:351:17)
Is there any way to get the data from twitter api for any location?
var sanFrancisco = ['79.86','12.62','80.28','13.21']
var stream = T.stream('statuses/filter', { locations: sanFrancisco })
stream.on('tweet', function (tweet) {
console.log(tweet)
It gives an error:
Error: Bad Twitter streaming request: 401
at Object.exports.makeTwitError (/home/file_upload/node_modules/twit/lib/helpers.js:74:13)
at IncomingMessage. (/home/file_upload/node_modules/twit/lib/streaming-api-connection.js:95:29)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickCallback (node.js:419:13)
I assume you followed the usage guide here https://github.com/ttezel/twit#usage and created the twit object with suitable OAuth keys?
Another possibility for this error is if your clock is out of sync, the twitter endpoint will reject requests if the time is out by a few minutes. Check your computers time is correct.