Registry / auth-security / ember-simple-auth-token

ember-simple-auth-token

JSON →
library6.0.1jsnpmunverified

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.

npm install ember-simple-auth-token
INSTALL
IMPORT
SIG · EMBER-SIMPLE-AUTH-
E
ember-simple-auth-token
auth-securityjavascriptv6.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JWTTokenAuthenticator
import JWTTokenAuthenticator from 'ember-simple-auth-token/authenticators/jwt';
import JWTTokenAuthenticator from 'ember-simple-auth-token';
Default export from the JWT authenticator module. v6 uses v2 addon, so path is correct as shown.
TokenAuthenticator
import TokenAuthenticator from 'ember-simple-auth-token/authenticators/token';
import { TokenAuthenticator } from 'ember-simple-auth-token';
Default export, not named export. Use direct path to authenticator module.
TokenAuthorizer
import TokenAuthorizer from 'ember-simple-auth-token/authorizers/token';
import { TokenAuthorizer } from 'ember-simple-auth-token/authorizers';
Default export from the authorizer module.
DataAdapterMixin
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
import DataAdapterMixin from 'ember-simple-auth-token/mixins/data-adapter-mixin';
Since v5.2.2, DataAdapterMixin is provided by ember-simple-auth, not this addon.

Configures JWT authenticator, token authorizer, session setup in application route, and authenticated route with requireAuthentication.

// app/authenticators/jwt.js import JWTTokenAuthenticator from 'ember-simple-auth-token/authenticators/jwt'; export default class JWTAuthenticator extends JWTTokenAuthenticator { // optional: override serverTokenEndpoint, etc. } // app/authorizers/application.js import TokenAuthorizer from 'ember-simple-auth-token/authorizers/token'; export default class ApplicationAuthorizer extends TokenAuthorizer {} // app/routes/application.js import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; export default class ApplicationRoute extends Route { @service session; async beforeModel() { await this.session.setup(); } } // app/routes/authenticated.js import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; export default class AuthenticatedRoute extends Route { @service session; beforeModel(transition) { this.session.requireAuthentication(transition, 'login'); } } // config/environment.js ENV['ember-simple-auth-token'] = { serverTokenEndpoint: '/api/token', serverTokenRefreshEndpoint: '/api/token/refresh', identificationField: 'username', passwordField: 'password', tokenPropertyName: 'token', refreshTokenPropertyName: 'refresh_token', refreshLeeway: 300 // seconds };
Debug
Known issues
breakingv6.0.0 drops support for Ember < 4, Node < 16, and ember-simple-auth < 6.
fix
Upgrade to Ember 4+ and Node 16+. Install ember-simple-auth@6.
affects: >=6.0.0 <6.1.0
breakingv6.0.0 changes to v2 addon format. You must manually call session.setup() in application route.
fix
Add session.setup() call in application route's beforeModel hook.
affects: >=6.0.0
deprecatedDataAdapterMixin is no longer provided by this addon since v5.2.2. Use ember-simple-auth's mixin instead.
fix
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
affects: >=5.2.2
gotchaember-simple-auth is a peer dependency and must be installed manually.
fix
Run 'ember install ember-simple-auth' in addition to installing this addon.
affects: *
gotchaYou must use HTTPS in production to protect token and credentials in transit.
fix
Configure your server to use HTTPS.
affects: *
Errors
Common errors & fixes
Error: Could not find module `ember-simple-auth-token/authenticators/jwt`
Import path incorrect or addon not installed.
fix
Ensure addon is installed: `ember install ember-simple-auth-token`. Use correct import path: `import JWTTokenAuthenticator from 'ember-simple-auth-token/authenticators/jwt';`
Uncaught TypeError: session.setup is not a function
Missing call to session.setup() in application route (required since v6).
fix
In app/routes/application.js, call `await this.session.setup();` in beforeModel.
Cannot read property 'requireAuthentication' of undefined
session service not injected or not properly set up.
fix
Inject session service with `@inject session;` and ensure session.setup() is called before accessing session methods.
Upgrade
Version history
6.0.1latest on npm
Audit
Dependencies
ember-simple-authrequiredPeer dependency; must be installed manually (>= 6.0.0)
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
2
Resources
ember-simple-auth-token — npm install ember-simple-auth-token · libregistry