{"id":18310,"library":"ember-simple-auth-token","title":"Ember Simple Auth Token","description":"An Ember addon extending Ember Simple Auth with token-based authentication (JWT) support, including automatic token refresh. Current stable version: 6.0.1. Release cadence is sporadic, with major version bumps aligning with Ember and ember-simple-auth upgrades. Key differentiators: JWT auto-refresh, v2 addon format, and compatibility with Ember 4+ and ember-simple-auth v6. Alternatives include custom authentication strategies or other ESA extensions.","status":"active","version":"6.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/fenichelar/ember-simple-auth-token","tags":["javascript","ember-addon"],"install":[{"cmd":"npm install ember-simple-auth-token","lang":"bash","label":"npm"},{"cmd":"yarn add ember-simple-auth-token","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-simple-auth-token","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; must be installed manually (>= 6.0.0)","package":"ember-simple-auth","optional":false}],"imports":[{"note":"Default export from the JWT authenticator module. v6 uses v2 addon, so path is correct as shown.","wrong":"import JWTTokenAuthenticator from 'ember-simple-auth-token';","symbol":"JWTTokenAuthenticator","correct":"import JWTTokenAuthenticator from 'ember-simple-auth-token/authenticators/jwt';"},{"note":"Default export, not named export. Use direct path to authenticator module.","wrong":"import { TokenAuthenticator } from 'ember-simple-auth-token';","symbol":"TokenAuthenticator","correct":"import TokenAuthenticator from 'ember-simple-auth-token/authenticators/token';"},{"note":"Default export from the authorizer module.","wrong":"import { TokenAuthorizer } from 'ember-simple-auth-token/authorizers';","symbol":"TokenAuthorizer","correct":"import TokenAuthorizer from 'ember-simple-auth-token/authorizers/token';"},{"note":"Since v5.2.2, DataAdapterMixin is provided by ember-simple-auth, not this addon.","wrong":"import DataAdapterMixin from 'ember-simple-auth-token/mixins/data-adapter-mixin';","symbol":"DataAdapterMixin","correct":"import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';"}],"quickstart":{"code":"// app/authenticators/jwt.js\nimport JWTTokenAuthenticator from 'ember-simple-auth-token/authenticators/jwt';\nexport default class JWTAuthenticator extends JWTTokenAuthenticator {\n  // optional: override serverTokenEndpoint, etc.\n}\n\n// app/authorizers/application.js\nimport TokenAuthorizer from 'ember-simple-auth-token/authorizers/token';\nexport default class ApplicationAuthorizer extends TokenAuthorizer {}\n\n// app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { inject as service } from '@ember/service';\nexport default class ApplicationRoute extends Route {\n  @service session;\n  async beforeModel() {\n    await this.session.setup();\n  }\n}\n\n// app/routes/authenticated.js\nimport Route from '@ember/routing/route';\nimport { inject as service } from '@ember/service';\nexport default class AuthenticatedRoute extends Route {\n  @service session;\n  beforeModel(transition) {\n    this.session.requireAuthentication(transition, 'login');\n  }\n}\n\n// config/environment.js\nENV['ember-simple-auth-token'] = {\n  serverTokenEndpoint: '/api/token',\n  serverTokenRefreshEndpoint: '/api/token/refresh',\n  identificationField: 'username',\n  passwordField: 'password',\n  tokenPropertyName: 'token',\n  refreshTokenPropertyName: 'refresh_token',\n  refreshLeeway: 300 // seconds\n};","lang":"javascript","description":"Configures JWT authenticator, token authorizer, session setup in application route, and authenticated route with requireAuthentication."},"warnings":[{"fix":"Upgrade to Ember 4+ and Node 16+. Install ember-simple-auth@6.","message":"v6.0.0 drops support for Ember < 4, Node < 16, and ember-simple-auth < 6.","severity":"breaking","affected_versions":">=6.0.0 <6.1.0"},{"fix":"Add session.setup() call in application route's beforeModel hook.","message":"v6.0.0 changes to v2 addon format. You must manually call session.setup() in application route.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';","message":"DataAdapterMixin is no longer provided by this addon since v5.2.2. Use ember-simple-auth's mixin instead.","severity":"deprecated","affected_versions":">=5.2.2"},{"fix":"Run 'ember install ember-simple-auth' in addition to installing this addon.","message":"ember-simple-auth is a peer dependency and must be installed manually.","severity":"gotcha","affected_versions":"*"},{"fix":"Configure your server to use HTTPS.","message":"You must use HTTPS in production to protect token and credentials in transit.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure addon is installed: `ember install ember-simple-auth-token`. Use correct import path: `import JWTTokenAuthenticator from 'ember-simple-auth-token/authenticators/jwt';`","cause":"Import path incorrect or addon not installed.","error":"Error: Could not find module `ember-simple-auth-token/authenticators/jwt`"},{"fix":"In app/routes/application.js, call `await this.session.setup();` in beforeModel.","cause":"Missing call to session.setup() in application route (required since v6).","error":"Uncaught TypeError: session.setup is not a function"},{"fix":"Inject session service with `@inject session;` and ensure session.setup() is called before accessing session methods.","cause":"session service not injected or not properly set up.","error":"Cannot read property 'requireAuthentication' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}