grails (11) vaadin (11) meteor (6) java (4) elasticsearch (3) apple (2) centos (1) cloudbees (1) google analytics (1) gradle (1) heroku (1) javafx (1) javascript (1) jdbc (1) jug (1) logback (1) logging (1) mac os (1) management (1) mongodb (1) mongolab (1) mysql (1) twitter (1) ubuntu (1)

Tuesday, July 30, 2013

Meteor: How to send email from client


  1. Make sure you have got email package in projectfolder/.meteor/packages file.
  2. Create server side code in order to send email (Email.send can be called only on server side). That code you can call from client later on.
  3. Make a template that show a link that invokes client side JavaScript that sends the email.
  4. Make the call from the client in order to send an email.



Sunday, July 21, 2013

Meteor: How to login with Email, GitHub, Twitter, Google and Facebook account and add credentials to an existing user account

When an user has already an account in the Meteor application, we don't want to create another user in MongoDB when he tries to login with other OAuth service. Rather we connect the accounts and add a new login service to the existing user's services collection.

This code doesn't work for Twitter, because Twitter does not return email in the user data. Therefore, there is no way how to to connect Twitter account by email. I propose to exclude Twitter from your application until it is solved by Meteor (requestPermissions).

Also Github can have an account without email. So when user tries to login with GitHub without email, a new account is created.

Just create a new file oauth.js in server folder and copy paste the code below.

Thanks to Gadi Cohen post.
TextLab for Mac
Ultimate application to validate, clean and format JSON, XML, SQL, HTML.

Meteor: Login with Github on Heroku

It is a bit tricky to setup Meteor application to login with external service on Heroku (if you want to use your own domain). You need to do the following:

  1. While creating an application on Github, you have to use the same pattern for URLs. If you choose to use www prefix, use it everywhere.
  2. Then go to the console and set ROOT_URL (heroku config:add ROOT_URL=http://www.templhub.com). You need to have it EXACTLY the same as in GitHub application configuration.