Reputation: 1165
I have twitter authentication working correctly, however I need more than just the username and display name which is only what Passport is restricted to.
I am trying to do this:
var newUser = new User();
newUser.uid = profile.id;
newUser.token = token;
newUser.username = profile.username;
newUser.displayName = profile.displayName;
newUser.profile_image_url = profile.profile_image_url;
If was looking at the passport documentation and it restricts the data you can use. I'm guessing so that it is consistent if you are using multiple authentication methods, but I only need to use twitter.
passport.use(new TwitterStrategy({ ... },
function(token, tokenSecret, profile, done) {
console.log(profile);
....
}
);
If I just log the profile then it gives all the data so i'm confused how I can get around it. I need the complete data from twitter, not just a few that passport picks out for me, how can i get this?
Upvotes: 0
Views: 210
Reputation: 1165
I have a simple solution which works fine for me:
var image_url = profile._json.profile_image_url.replace('_normal','');
I know that removing the _normal from the string like that may not be the best way logically but it works and stores the original image url in the DB.
Upvotes: 1