Adding another social authentication method
-
Hi guys,
First of all, congratz! This project is awesome!
Second, I started my studies on node.js a week ago and I'm very excited about it.
I have a project in mind (I've acctualy already started the design and some modules using node/express/socket.io) and this project requires a board to community and this is were I found NodeBB.
I would like to integrate with Steam OpenID for Register/Login.
It would be a huge effort to add this authentication method?
--
Edited: looking at the github project, I found passport, wich use the OpenID provider. I guess it's the way, right?
Thanks
-
Hi nanoVapor,
Yes, we use the passport package as our underlying single sign-on mechanism, so adding more options like Steam is quite simple.
It is possible to replicate an existing plugin and re-appropriate it for Steam Logins. For example, take a look at the GitHub SSO NodeBB plugin that @psychobunny wrote.
-
Hi,
After some study and tests, I'm falling on an error that I have no clue..
My plugin is working (i guess). I used the github plugin, also the twitter login (to use the avatar from steam), and I can get the user registered successfull, with the name, avatar, everything, but someting is going on at the return from Steam login page.
Here the main code, there is no err, it's executing the done(null, user)
Steam.login(newProfile.id, newProfile.username, newProfile.avatar, function(err, user) { if (err) { return done(err); } done(null, user); });
The value of user is: { uid: '2' } (after register or after login).
And the error on console is:
/home/igor/web/nodebb/node_modules/redis/index.js:535
throw err;
^
TypeError: object is not a function
at /home/igor/web/nodebb/node_modules/nodebb-plugin-openid-steam/library.js:45:17
at /home/igor/web/nodebb/node_modules/nodebb-plugin-openid-steam/library.js:71:9
at /home/igor/web/nodebb/node_modules/nodebb-plugin-openid-steam/library.js:104:7
at try_callback (/home/igor/web/nodebb/node_modules/redis/index.js:532:9)
at RedisClient.return_reply (/home/igor/web/nodebb/node_modules/redis/index.js:613:13)
at HiredisReplyParser.<anonymous> (/home/igor/web/nodebb/node_modules/redis/index.js:266:14)
at HiredisReplyParser.EventEmitter.emit (events.js:95:17)
at HiredisReplyParser.execute (/home/igor/web/nodebb/node_modules/redis/lib/parser/hiredis.js:43:18)
at RedisClient.on_data (/home/igor/web/nodebb/node_modules/redis/index.js:488:27)
at Socket.<anonymous> (/home/igor/web/nodebb/node_modules/redis/index.js:82:14)
DEBUG: Program node app exited with code 8Line 45 of the library.js is from the main code I've posted above: done(null, user);
Any clue from that or it's better post my project at Github?
Thanks
-
done(null, user);
Where is that defined? I don't see it in the code you posted. Are you sure it is a function?
Never mind.. I fixed it
passport.use(new passportSteam({ returnURL: module.parent.require('nconf').get('url') + 'auth/steam/callback', realm: module.parent.require('nconf').get('url') }, function(identifier, profile, done) {...});
profile parameter was missing.. Now I'm logged in with my Steam account
I'll run more tests, improve the code and put on github for the pros take a look.
--
By the way, as FontAwesome doesn't have the Steam icon, I'm using the gamepad icon. It's ok on admin page, but in user login page, on alternative logins, the code puts a -square suffix on the <i> element class. And there are no fa-gamepad-square, so I used another icon that have a square suffix on that page...
-
Adding a new post, here the first version of my plugin:
GitHub - igorprado/nodebb-plugin-sso-steam: NodeBB Plugin that allows users to login/register via their Steam account.
NodeBB Plugin that allows users to login/register via their Steam account. - igorprado/nodebb-plugin-sso-steam
GitHub (github.com)