skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
meteor/agent-skills326 installs

meteor-accounts

Use when wiring up authentication in a Meteor 3 app. Triggers on accounts-password, accounts-base, OAuth (Google, Facebook, GitHub, Apple, Twitter, Meetup, Weibo), accounts-2fa, accounts-passwordless, ServiceConfiguration.configurations.upsertAsync, Accounts.createUserAsync, Accounts.setPasswordAsync, Accounts.forgotPassword, Accounts.resetPassword, Accounts.verifyEmail, useHttpOnlyCookies, clientStorage, Meteor.loginWithPasswordAnd2faCode, email verification, accounts-express, authFetchAllowedOrigins. Use this skill when the user asks about signups, signins, or asks about token storage vs HttpOnly cookies.

How do I install this agent skill?

npx skills add https://github.com/meteor/agent-skills --skill meteor-accounts
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides comprehensive instructions and reference material for implementing authentication in Meteor 3 applications. It focuses on secure practices such as using HttpOnly cookies, managing OAuth secrets via environment variables, and implementing 2FA. No security issues were detected.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

Meteor accounts

accounts-base plus a flavor package (accounts-password, accounts-google, etc.). Meteor stores users in Meteor.users and ships the client a resume token mapped to that document.

Decision flow

  1. Username + password? Add accounts-password.
  2. Social login? Add accounts-base plus the provider package (e.g. accounts-google) and configure the service.
  3. Magic-link? Add accounts-passwordless.
  4. 2FA? Layer accounts-2fa on top of accounts-password.
  5. Token storage on the client? Default is Web Storage. Meteor 3.3+ supports an HttpOnly cookie flow; see the section below.

For a custom users collection, configure both runtimes before app reads or validators. Meteor 3.6 fixes collection setup and publication lookup; review collection identity and client-write policy before changing profile rules.

Username + password

// server/accounts.js
import { Accounts } from "meteor/accounts-base";
import { Meteor } from "meteor/meteor";

Meteor.startup(() => {
  Accounts.config({
    sendVerificationEmail: true,
  });

  Accounts.emailTemplates.siteName = "My App";
  Accounts.emailTemplates.from = "no-reply@example.com";
});

The from address is required; Meteor 3.5+ logs a server warning if you omit it.

Do not set forbidClientAccountCreation: true when the client signup form calls Accounts.createUser or Accounts.createUserAsync. The server rejects that request with 403 Signups forbidden. For invite-only or administrator provisioning, set the option on both client and server, remove the public signup UI, and call Accounts.createUserAsync only from trusted server code after its own authorization check.

// client/signin.js (Meteor 3.5+)
import { Meteor } from "meteor/meteor";
import { Accounts } from "meteor/accounts-base";

async function signUp({ email, password }) {
  await Accounts.createUserAsync({ email, password });
}

async function signIn({ email, password }) {
  await Meteor.loginWithPasswordAsync(email, password);
}

Client Accounts.createUser(options, callback) also remains supported. Meteor.loginWithPasswordAsync was added in Meteor 3.5; on older 3.x use the callback form of Meteor.loginWithPassword or wrap it in a Promise.

On the server use await Accounts.createUserAsync(options) and await Accounts.setPasswordAsync(userId, newPassword).

HttpOnly cookies (Meteor 3.3+)

Default token storage is Web Storage. To move the resume token into an HttpOnly cookie and keep the client tab in-memory only:

// server
Meteor.startup(() => {
  Accounts.config({
    clientStorage: "none",
    useHttpOnlyCookies: true,
  });
});
// settings.json (public; surfaces the same flags to the client)
{
  "public": {
    "packages": {
      "accounts": {
        "clientStorage": "none",
        "useHttpOnlyCookies": true
      }
    }
  }
}

After restart and login, verify an HttpOnly meteor_login_token cookie and no persisted Meteor.loginToken*. Tabs still hold credentials in memory for DDP; active same-origin XSS can access them.

With accounts-base@3.3.1 (Meteor 3.5.2), the server handles cookie endpoints only when it is opted in too. A client-only setting can therefore produce an HTML response or 404 from later handlers. The /set body limit is 4096 bytes; larger requests return HTTP 413. See cookie endpoint troubleshooting for the routes, version boundary, and diagnostic checks. Meteor 3.6's accounts-base@3.4.0 also requires trusted origins and valid tokens, uses SameSite=Strict, and adds a separate per-address endpoint rate limit. These protections are also backported in Meteor 3.5.5's accounts-base@3.3.2. Review custom callers and cross-site entry flows before upgrading. Distinguish invalid sessions from transient or rate-limit responses before retrying or discarding credentials.

OAuth (Google example)

// server/oauth.js
import { ServiceConfiguration } from "meteor/service-configuration";

await ServiceConfiguration.configurations.upsertAsync(
  { service: "google" },
  {
    $set: {
      clientId: process.env.GOOGLE_CLIENT_ID,
      secret: process.env.GOOGLE_CLIENT_SECRET,
      loginStyle: "popup",
    },
  },
);
// client
Meteor.loginWithGoogle(
  { requestPermissions: ["email", "profile"] },
  (err) => { if (err) console.error(err); },
);

loginStyle: "redirect" for mobile or environments without window.close / window.opener. Each provider ships its own accounts-<service> package: accounts-google, accounts-github, accounts-facebook, accounts-twitter, accounts-apple, accounts-meetup, accounts-weibo.

For native Google/Facebook login, see native token validation. For production setup on 3.4.4, 3.5.5 and 3.6.1, use server configuration; see client configuration restrictions.

For accounts-express authenticated fetch, check the resolved version and trusted destinations before forwarding credentials to another origin. Cookie endpoint and fetch allowlists are separate.

For provider and per-user credential encryption, use oauth-encryption and top-level Accounts.config({ oauthSecretKey }). See meteor-security and the OAuth reference for supported fields and key requirements.

Email verification and reset

The 3.4.4, 3.5.5 and 3.6.1 security releases add verification-link expiry and password-change revocation. Follow password flows for exact package pairings, configuration and earlier-version behavior.

Use the client callbacks for forgotPassword, resetPassword and verifyEmail; await their server email APIs. The reference also covers Accounts.urls and email-template customization, stale links and 2FA.

Passwordless

Add accounts-passwordless. Request a one-time code or link, then submit the code with the same selector:

Accounts.requestLoginTokenForUser(
  {
    selector: { email },
    userData: { email },
    options: { userCreationDisabled: false },
  },
  (error) => { if (error) console.error(error); },
);

Meteor.passwordlessLoginWithToken(
  { email },
  token,
  (error) => { if (error) console.error(error); },
);

Set userCreationDisabled: true for sign-in-only flows. Configure tokenSequenceLength, loginTokenExpirationHours, and the Accounts.emailTemplates.sendLoginToken template on the server. Treat the token-request method as an abuse-sensitive endpoint and rate-limit repeated requests. With Meteor 3.6's accounts-passwordless@3.1.2 and accounts-base@3.4.0, the complete request is validated before lookup/creation and joins the default Accounts DDP rate rule. The 3.4.4 and 3.5.5 backports also validate/throttle requests. See passwordless request boundaries for custom callers, one-time completion, 2FA and earlier packages. Retain the default limiter and handle callback errors without an immediate retry loop.

2FA

accounts-2fa adds TOTP. The login flow:

  1. Client calls Meteor.loginWithPasswordAsync(user, password) on Meteor 3.5+, or the callback form of Meteor.loginWithPassword on older 3.x.
  2. Server rejects with error.error === 'no-2fa-code'.
  3. Client prompts for a code, retries with Meteor.loginWithPasswordAnd2faCode(user, password, code, cb).

Anti-patterns

  • Store the OAuth secret in Meteor.settings.public. The client sees public. Put secrets at the top level of settings.json.
  • Build a custom password hash. accounts-password uses bcrypt; trust it.
  • Bypass forbidClientAccountCreation with a method that takes a password. Same risk.
  • Run Accounts.config({ ... }) inside a deferred path. Call it at top level or in Meteor.startup.

See also

  • references/password-flows.md
  • references/oauth-services.md
  • references/eval-cases.md
  • For OAuth-secret encryption and CSP, see the meteor-security skill.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/meteor/agent-skills/meteor-accounts">View meteor-accounts on skillZs</a>