1.0.1 • Published 8 years ago

meteor-subdomain-persistent-login-fixed v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

Subdomain login persistence for your meteor apps

To install this in your meteor app:

npm install --save meteor-subdomain-persistent-login-fixed

In your main client javascript file:

import initSubdomainPersistentLogin from 'meteor-subdomain-persistent-login'

Meteor.startup(() => {
  initSubdomainPersistentLogin(Meteor, ['app.localhost'])
})

This will set the cookie for all subdomains of app.localhost and app.localhost itself.

Replace app.localhost with your domain. If you host your app on multiple domains you can even give a list of domains. However the login will not persist between domains, because that is not possible with cookies.

Configuration

initSubdomainPersistentLogin takes an object as a optional third argument, containing further configuration data:

initSubdomainPersistentLogin(
  Meteor,
  ['app.localhost'],
  {
    expiresAfterDays: 30,
    cookieName: 'meteor_subdomain_token'
  }
)
  • expiresAfterDays : After how many days the cookie will expire (default: 30).
  • cookieName: Which name to use for the cookie (default: "meteor_subdomain_token").

This is based on the work by jfrolich, from the package "meteor-subdomain-persistent-login" that I couldn't get to work.