passport.js

Retrieve Linkedin user’s information

北慕城南 提交于 2019-12-11 16:44:41
问题 I’m currently developing a NodeJS App and am intending to retrieve Linkedin user’s experience, education and skills. When doing so I get the error below. How can I avoid this error? Here the workflow followed that leads to the error: http://3.14.113.64:4000/ InternalOAuthError: failed to fetch user profile at _oauth2.get (/linkedin-connection/node_modules/passport-linkedin-oauth2/lib/oauth2.js:70:23) at passBackControl (/linkedin-connection/node_modules/oauth/lib/oauth2.js:132:9) at

Axios data coming out to be undefined

与世无争的帅哥 提交于 2019-12-11 15:56:49
问题 I have a route in nodeJs which looks like this app.get("/", (req, res) => { console.log(req.user) res.json(req.user) }) Here console.log showing undefined but if I visit the address (localhost:3000/) it displays the following the data (in json) // 20181025193337 // http://localhost:3000/ { "isFormFilled": false, "_id": "5bd1a3d82101d36407f81218", "username": "Rohit Bhatia", "userId": "102775073203963169965", "image": "https://lh5.googleusercontent.com/-7HxFRQOCd9Q/AAAAAAAAAAI/AAAAAAAAAU8

Express, Create-React-App, & passport-twitter

◇◆丶佛笑我妖孽 提交于 2019-12-11 15:56:34
问题 I am setting up Twitter oauth on my create-react-app application by using a helper function (via axios ) on the front end to initiate the passport oauth process on my backend. I am currently in development, so I am hosting my express server on port 3001 and my front end on port 3000 with a proxy on the front end to port 3001. I have set up CORS permissions via the cors npm package. No matter what set of configurations I try, I am unable to complete the Twitter OAuth process. I have tried

unable hash the password in mean stack

若如初见. 提交于 2019-12-11 15:14:24
问题 This is the code from routes file. router.put('/reset/:token', function(req, res, next) { console.log('reseting the password'); User.findOne({resetPasswordToken:req.params.token}, function(err, user) { if(err) { return next(err); } if (!user) { return res.status(422).json({errors: [{msg: 'invalid reset token'}]}); } user.resetPasswordToken =''; user.resetPasswordExpires = ''; user.password = req.body.password; User.addUser(user, (err, user) => { if(err){ res.json({success: false, msg:

[Passportjs][Angular5] No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access

ぃ、小莉子 提交于 2019-12-11 14:56:00
问题 I am trying to integrate Nodejs backend api with Angular. I have implemented passpor-google, passport-github, passport-twitter strategy on the backend application. My backend App url is http://localhost:3000 My Frontend App url is http://localhost:4200 Passport Routes authRouter.get('/github', passport.authenticate('github')); authRouter.get( '/github/callback', passport.authenticate('github', { failureRedirect: 'http://localhost:4200/login', }), authController.sendJWTToken ); When i send

Mongoose “Create” method - Is there no callback? (Using passport and angular)

≡放荡痞女 提交于 2019-12-11 14:53:12
问题 I am using mongoose to create a user object on register. This works fine and any errors are returned as expected. However, I want to log the user on right after they register (so registering logs you on if there are no errors). I have the following for the register. register_controller: $scope.submitRegister = function() { AuthenticationService.register(this.details).success(function() { $log.debug('/POST to /api/register worked'); }); } services.js: .service('AuthenticationService', function

How can I export a variable from one file and require() the exported variable on another file?

主宰稳场 提交于 2019-12-11 14:47:29
问题 my folder structure : collegesapp -- |-- node_modules -- express | -- connect | -- jade | -- passport |-- routes -- routes.js |-- views -- index.jade | -- signin.jade |-- app.js |-- package.json exports.serialized_user = "Alex"; //in app.js file var serialized_user = require('../app.js').serialized_user; //in routes.js file So, when I add console.log(serialized_user ) to my routes.js file and run the application, I end up having seeing undefined in console instead of "Alex". What do you think

Node Passport invitation strategy

…衆ロ難τιáo~ 提交于 2019-12-11 13:14:11
问题 I’m creating a multi-user app where only the admin can add new users through an invitation. I looked at Passport but I don’t see a way to implement a kind of “invitation strategy” (similar to Devise in RoR); any ideas ? 回答1: The Strategy is how you authenticate someone, where Invitations are about how users register. They're two different areas of concern in your app. What I do is have the Invitation be created by the admin and so on, and when the user clicks on the link to their invitation

How to use two separate passport instances in a single express server file

只愿长相守 提交于 2019-12-11 11:10:03
问题 I have an express app with a user and admin section. Both will run on different ports and need different authentication. I created an app.js where I include passport and create an app as well as adminApp. Then I initialize passport for both as follows: var passport = require('passport'); var app = express(); var adminapp = express(); adminapp.use(passport.initialize()); adminapp.use(passport.session()); app.use(passport.initialize()); app.use(passport.session()); Now I have routes defined to

FacebookGraphAPIError: (#210) This call requires a Page access token

孤街浪徒 提交于 2019-12-11 08:36:38
问题 I am using Passport-Facebook strategy for authentication. Please find the code below: new FacebookStrategy( { clientID: authConfig.facebookAuth.clientID, clientSecret: authConfig.facebookAuth.clientSecret, callbackURL: authConfig.facebookAuth.callbackURL, profileURL: "https://graph.facebook.com/v2.10/me", authorizationURL: "https://www.facebook.com/v2.10/dialog/oauth", tokenURL: "https://graph.facebook.com/v2.10/oauth/access_token", profileFields: ["email", "profile_pic", "gender"] },