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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
OIDCAuthenticationRoute
✓ import OIDCAuthenticationRoute from 'ember-simple-auth-oidc/routes/oidc-authentication';
✗ const OIDCAuthenticationRoute = require('ember-simple-auth-oidc/routes/oidc-authentication');
Ember addons primarily use ES Modules; CommonJS `require` is not supported for routes.
OIDCJSONAPIAdapter
✓ import OIDCJSONAPIAdapter from 'ember-simple-auth-oidc/adapters/oidc-json-api-adapter';
✗ import { OIDCJSONAPIAdapter } from 'ember-simple-auth-oidc/adapters/oidc-json-api-adapter';
This is a default export from its specific path, not a named export from the root package.
apolloMiddleware
✓ import { apolloMiddleware } from 'ember-simple-auth-oidc';
✗ import apolloMiddleware from 'ember-simple-auth-oidc/utils/apollo-middleware';
The `apolloMiddleware` utility is a named export directly from the root package.
This quickstart demonstrates the core setup for `ember-simple-auth-oidc`, including environment configuration, defining an authentication route, securing a protected route, and integrating with Ember Data for authenticated API requests. It also shows an optional setup for Apollo Client integration.
/* config/environment.js */
module.exports = function (environment) {
let ENV = {
modulePrefix: 'my-app',
environment,
rootURL: '/',
locationType: 'history',
EmberENV: {
FEATURES: {},
EXTEND_PROTOTYPES: {
Date: false
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
'ember-simple-auth': {
authenticationRoute: 'login'
},
'ember-simple-auth-oidc': {
clientId: process.env.OIDC_CLIENT_ID ?? 'my-oidc-client',
issuer: process.env.OIDC_ISSUER ?? 'https://my-auth-server.com/realms/my-realm',
redirectUri: process.env.OIDC_REDIRECT_URI ?? 'http://localhost:4200/login',
scope: 'openid profile email',
responseType: 'code',
postLogoutRedirectUri: process.env.OIDC_LOGOUT_URI ?? 'http://localhost:4200/',
tokenEndpoint: process.env.OIDC_TOKEN_ENDPOINT ?? 'https://my-auth-server.com/realms/my-realm/protocol/openid-connect/token',
logoutEndpoint: process.env.OIDC_LOGOUT_ENDPOINT ?? 'https://my-auth-server.com/realms/my-realm/protocol/openid-connect/logout'
}
};
return ENV;
};
/* app/routes/login.js */
import OIDCAuthenticationRoute from "ember-simple-auth-oidc/routes/oidc-authentication";
export default class LoginRoute extends OIDCAuthenticationRoute {}
/* app/routes/protected.js */
import Route from "@ember/routing/route";
import { service } from "@ember/service";
export default class ProtectedRoute extends Route {
@service session;
async beforeModel(transition) {
await this.session.requireAuthentication(transition, "login");
}
}
/* app/adapters/application.js */
import { service } from "@ember/service";
import OIDCJSONAPIAdapter from "ember-simple-auth-oidc/adapters/oidc-json-api-adapter";
export default class ApplicationAdapter extends OIDCJSONAPIAdapter {
@service session;
get headers() {
return { ...this.session.headers, "Content-Language": "en-us" };
}
}
// Example for Apollo client integration (optional)
/* app/services/apollo.js */
// import { service } from "@ember/service";
// import ApolloService from "ember-apollo-client/services/apollo";
// import { apolloMiddleware } from "ember-simple-auth-oidc";
// export default class CustomApolloService extends ApolloService {
// @service session;
// link() {
// const httpLink = super.link();
// return apolloMiddleware(httpLink, this.session);
// }
// }
Errors
Common errors & fixes
Error: Assertion Failed: The session is not authenticated.
An unauthenticated user attempted to access a protected route without being redirected to the login route, or `session.requireAuthentication` was not awaited.
fixEnsure all protected routes call `await this.session.requireAuthentication(transition, 'login');` in their `beforeModel` hook, and that the `login` route extends `OIDCAuthenticationRoute`.
Failed to compile: Error: Module 'ember-simple-auth-oidc' does not contain an export named 'SomeSymbol'
Attempting to import a symbol with the wrong import style (e.g., named vs. default) or from an incorrect path, or using CommonJS `require()` syntax with an ESM-only addon.
fixVerify the correct import path and style (named vs. default export) from the package documentation. Use `import ... from '...'` syntax for Ember addons.
401 Unauthorized or CORS error during token refresh or API calls.
Issues with `access_token` not being refreshed before an Ember Data request, incorrect `headers` configuration, or misconfigured OIDC endpoints.
fixEnsure your application adapter extends `OIDCJSONAPIAdapter` or `OIDCRESTAdapter` and that your `headers` getter includes `...this.session.headers`. Also, confirm that `tokenEndpoint` and `issuer` configurations in `config/environment.js` are correct.
Audit
Dependencies
ember-simple-authrequiredCore authentication library this addon extends.
ember-datarequiredRequired for Ember Data adapter extensions like OIDCJSONAPIAdapter.
ember-sourcerequiredFundamental Ember.js dependency.
@apollo/clientoptionalPeer dependency for integration with ember-apollo-client for GraphQL authorization.
@embroider/macrosrequiredBuild-time macros for Embroider compatibility.
@ember-data/adapterrequiredRequired for Ember Data adapter extensions.
@ember/test-waitersrequiredAids in ensuring tests wait for asynchronous operations.