meteor - Meteorjs link social media accounts -
i'm attempting use bozhao:link-accounts package atmosphere, no luck. rather linking accounts, creating additional accounts. here implementation looks like:
packages added:
meteor add accounts-facebook
meteor add accounts-twitter
meteor add bozhao:link-accounts
meteor add service-configuration
<!--/client/signin.html--> <template name="signintmpl"> <button class="btn btn-facebook">sign in facebook</button> </template> <!--/client/linktweets.html--> <template name="linktweetstmpl"> <button class="btn btn-twitter">connect twitter account</button> </template>
//client/signin.js template.siginintmpl.events({ 'click .btn-facebook': function() { meteor.loginwithfacebook({requestpermissions: ['email']}, function(err) { //do if conditional ... }) } }) //client/linktweets.js template.linktweetstmpl.events({ 'click .btn-twitter': function() { meteor.linkwithtwitter(function(err) { //do if conditional ... }) } }) //server/accounts.js var createserviceconfiguration; createserviceconfiguration = function(service, clientid, secret) { var config; serviceconfiguration.configurations.remove({ service: service }); config = { generic: { service: service, clientid: clientid, secret: secret }, instagram: { service: service, clientid: clientid, scope: 'basic', secret: secret, loginstyle: "redirect" }, facebook: { service: service, appid: clientid, secret: secret, loginstyle: "redirect" }, twitter: { service: service, consumerkey: clientid, secret: secret, loginstyle: "redirect" } }; switch (service) { case 'instagram': return serviceconfiguration.configurations.insert(config.instagram); case 'facebook': return serviceconfiguration.configurations.insert(config.facebook); case 'twitter': return serviceconfiguration.configurations.insert(config.twitter); default: return serviceconfiguration.configurations.insert(config.generic); } }; //dev keys createserviceconfiguration('instagram', 'api-key', 'api-secret') createserviceconfiguration('facebook', 'api-key', 'api-secret') createserviceconfiguration('twitter', 'api-key', 'api-secret') createserviceconfiguration('google', 'api-key', 'api-secret')
i sign in facebook , when click on "connect twitter button" goes through authorisation sequence fine, creates account altogether.
i recommend using https://atmospherejs.com/splendido/accounts-meld
instead want. documentation pretty self explanatory , supports wide range of account melding configurations.
Comments
Post a Comment