Description
My setup chooses Sequelize for data modelling, and it is linked to a Postgresql database. The scaffolding generated this portion of the user model in /server/api/user/user.model.js :
provider: DataTypes.STRING,
salt: DataTypes.STRING,
facebook: DataTypes.TEXT,
twitter: DataTypes.TEXT,
google: DataTypes.TEXT,
github: DataTypes.TEXT
To make Oauth work in this confirmation, I had to change the datatypes for facebook, google, twitter, and github to
twitter: DataTypes.JSON
. Since the generator had already created the table model in Postgresq;, I had to either drop that table or manually alter it. I assume this might cause problems with other Sequelize databases, since JSON is in Postgres but not some others. Not sure if it would cause more harm then good to change the generator template in this manner, but it worked for my purpose.
Secondly, I had to manually modify each of the /server/auth/twitter/passport.js type files to match proper sequelize syntax.
function(token, tokenSecret, profile, done) {
User.find({where: {
'twitter.id_str': profile.id }
})
in place of the original syntax (mongoose style)
function(token, tokenSecret, profile, done) {
User.find({
'twitter.id_str': profile.id
})
Hope this helps someone else!