Users and Accounts

After reading this article, you’ll know: What features in core Meteor enable user accounts How to use accounts-ui for a quick prototype How to use the useraccounts family of packages to build your login UI How to build a fully-featured password login experience How to enable login through OAuth providers like Facebook How to add custom data to Meteor’s users collection How to manage user roles and permissions Features in core Meteor Before we get into all of the different user-facing accounts

Meteor.loginWith<Service>

Client Meteor.loginWith<ExternalService>([options], [callback]) import { Meteor } from 'meteor/meteor' Source Log the user in using an external service. Arguments callback Function Optional callback. Called with no arguments on success, or with a single Error argument on failure. The callback cannot be called if you are using the "redirect" loginStyle, because the app will have reloaded in the meantime; try using client-side login hooks instead. Options requestPermissions A

jquery

jquery jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. The jquery package adds the jQuery library to the client JavaScript bundle. It has no effect on the server. In addition to the jquery package, Meteor provides several jQuery plugins as separate packages. These include: jquery-history jquery-layout jquery-waypoints

HTTP.del

Anywhere HTTP.del(url, [callOptions], [asyncCallback]) import { HTTP } from 'meteor/http' Source Send an HTTP DELETE request. Equivalent to calling HTTP.call with "DELETE" as the first argument. (Named del to avoid conflict with the Javascript keyword delete) Arguments url String The URL to which the request should be sent. callOptions Object Options passed on to HTTP.call. asyncCallback Function Callback that is called when the request is completed. Required on the client.

meteor publish

meteor publish Publishes your package. To publish, you must cd into the package directory, log in with your Meteor Developer Account and run meteor publish. By convention, published package names must begin with the maintainer's Meteor Developer Account username and a colon, like so: iron:router. To publish a package for the first time, use meteor publish --create. Sometimes packages may contain binary code specific to an architecture (for example, they may use an npm package). In that case, ru

random

random The random package provides several functions for generating random numbers. It uses a cryptographically strong pseudorandom number generator when possible, but falls back to a weaker random number generator when cryptographically strong randomness is not available (on older browsers or on servers that don't have enough entropy to seed the cryptographically strong generator). Random.id([n]) Returns a unique identifier, such as "Jjwjg6gouWLXhMGKW", that is likely to be unique in the whol

helpers

Client Template.myTemplate.helpers(helpers) import { Template } from 'meteor/templating' Source Specify template helpers available to this template. Arguments helpers Object Dictionary of helper functions by name.

Meteor.userId

Anywhere but publish functions Meteor.userId() import { Meteor } from 'meteor/meteor' Source Get the current user id, or null if no user is logged in. A reactive data source.

AccountsClient#logoutOtherClients

Client accountsClient.logoutOtherClients([callback]) Source Log out other clients logged in as the current user, but does not log out the client that calls this function. Arguments callback Function Optional callback. Called with no arguments on success, or with a single Error argument on failure.

onCreated

Client Template.myTemplate.onCreated import { Template } from 'meteor/templating' Source Register a function to be called when an instance of this template is created. Arguments callback Function A function to be added as a callback.