Registry / aws / ember-cognito

ember-cognito

JSON →
library4.0.2jsnpmunverified

ember-cognito is an Ember Addon that integrates the Ember.js authentication library, ember-simple-auth, with AWS Amplify and AWS Cognito User Pools. It provides a custom authenticator and a service to access Amplify authentication methods, streamlining user authentication in Ember applications using AWS's managed identity service. The current stable version is 4.0.2, released in December 2025. This addon has a consistent release cadence, frequently updating to support newer Ember.js and AWS Amplify versions. A key differentiator is its seamless integration with ember-simple-auth, abstracting the complexities of interacting directly with the AWS Cognito SDK via Amplify, and providing helpers for common authentication flows like sign-up, confirmation, and session management. It also requires specific configuration for modern Ember v2 addons and Embroider compatibility.

npm install ember-cognito
INSTALL
IMPORT
SIG · EMBER-COGNITO
E
ember-cognito
awsjavascriptv4.0.2
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.

Cognito Authenticator
import Authenticator from 'ember-cognito/authenticators/cognito';
import { Cognito } from 'ember-cognito/authenticators/cognito';
The Cognito Authenticator is often consumed via the 'authenticator:cognito' string identifier in ember-simple-auth, but can also be imported directly for custom scenarios. It's a default export from its specific path.
Cognito Service
import { service } from '@ember/service'; class MyComponent { @service cognito; }
import { cognito } from 'ember-cognito/services/cognito';
The cognito service is typically injected using the @service decorator in Ember components or controllers, rather than direct import.
emberCognitoRegistry
import emberCognitoRegistry from 'ember-cognito/registry';
Required for v2 addon setup in `ember-cli-build.js` or `app.js` to ensure module resolution, especially with Embroider. It's a default export.

This quickstart demonstrates how to authenticate a user with AWS Cognito using the `ember-simple-auth` session service and the `authenticator:cognito` authenticator. It also includes an example of using the injected `cognito` service for user registration.

import Component from '@ember/component'; import { action } from '@ember/object'; import { service } from '@ember/service'; import { tracked } from '@glimmer/tracking'; // Ensure your config/environment.js has: // cognito: { // poolId: "<your Cognito User Pool ID>", // clientId: "<your Cognito App Client ID>", // }, export default class LoginComponent extends Component { @service session; @tracked username = ''; @tracked password = ''; @tracked errorMessage = ''; @action updateUsername(event) { this.username = event.target.value; } @action updatePassword(event) { this.password = event.target.value; } @action async authenticate() { this.errorMessage = ''; // Clear previous errors try { await this.session.authenticate('authenticator:cognito', { username: this.username, password: this.password }); // Authentication successful, redirect or update UI console.log('User authenticated successfully!'); } catch (error) { this.errorMessage = error.message || String(error); console.error('Authentication error:', this.errorMessage); } } // Example of using the cognito service for signup @service cognito; @tracked signUpUsername = ''; @tracked signUpPassword = ''; @tracked signUpEmail = ''; @tracked signUpSuccess = false; @action async signUp() { this.errorMessage = ''; try { await this.cognito.signUp( this.signUpUsername, this.signUpPassword, { email: this.signUpEmail } ); this.signUpSuccess = true; console.log('Sign-up successful, check email for confirmation code.'); } catch (error) { this.errorMessage = error.message || String(error); console.error('Sign-up error:', this.errorMessage); } } }
Debug
Known issues
breakingVersion 4.0.0 converted `ember-cognito` to an Ember v2 addon, which requires explicit registry setup in your application's `ember-cli-build.js` or `app.js` file. Failing to do so will result in module resolution errors.
fix
Add `import emberCognitoRegistry from 'ember-cognito/registry';` and then spread `...emberCognitoRegistry()` (or `...emberCognitoRegistry('name-of-app')` for `ember-resolver`) into your `modules` configuration.
affects: >=4.0.0
breaking`ember-cognito` v4.0.0 updated the underlying AWS Amplify/Cognito SDK to v6.x. This may introduce breaking changes or require updates to how you interact with Amplify directly if your application uses it outside of `ember-cognito`'s provided services.
fix
Consult the AWS Amplify v6 migration guide and update any direct Amplify interactions in your application code.
affects: >=4.0.0
breakingVersion 2.0.0 dropped support for Node.js versions below 16. Applications running on older Node.js environments will fail to build or run correctly.
fix
Upgrade your Node.js environment to version 16 or newer.
affects: >=2.0.0
breakingIn v2.0.0, `ember-simple-auth` was changed from a direct dependency to a peer dependency. Ensure you have `ember-simple-auth` installed in your project at a compatible version (>= 8.0.0).
fix
Run `npm install ember-simple-auth` or `yarn add ember-simple-auth` to ensure it's a direct dependency of your application, and check its version against `ember-cognito`'s peer dependency requirements.
affects: >=2.0.0
breakingVersion 0.10.0-beta.0 (and subsequent 0.10.0 stable) replaced direct AWS Cognito SDK usage with AWS Amplify. This was a significant internal change that removed the `CognitoStorage` object and altered how tokens are managed, making existing direct Cognito SDK integrations incompatible.
fix
Migrate any direct Cognito SDK interactions to use the AWS Amplify library, or rely on the `ember-cognito` service for abstracted methods. The `CognitoStorage` object is no longer used.
affects: >=0.10.0
gotchaThe Cognito JavaScript SDK requires that your Cognito App Client be created without a client secret. Attempting to use a client with a secret will lead to authentication failures.
fix
When configuring your Cognito User Pool App Client in AWS, ensure the 'Generate client secret' checkbox is unchecked.
affects: All
Errors
Common errors & fixes
Could not find module `ember-cognito/registry`
Attempting to build or run an Ember application using `ember-cognito` v4.x without configuring the v2 addon registry.
fix
In your `ember-cli-build.js` or `app.js`, add `import emberCognitoRegistry from 'ember-cognito/registry';` and spread `...emberCognitoRegistry()` into your `modules` configuration.
Error: Cannot find module 'ember-simple-auth/mixins/data-adapter-mixin'
Your application has `ember-cognito` installed (>=v2.0.0) but is missing `ember-simple-auth` as a direct dependency or has an incompatible version.
fix
Run `npm install ember-simple-auth@latest` or `yarn add ember-simple-auth@latest` to ensure `ember-simple-auth` is installed and meets the `ember-cognito` peer dependency requirements.
Node.js vX.Y.Z is not supported. Please use Node.js v16 or higher.
Running an Ember CLI project with `ember-cognito` v2.0.0 or higher on an unsupported Node.js version.
fix
Upgrade your Node.js environment to version 16 or newer.
Missing credentials in config or authentication flow type
The `cognito` configuration in `config/environment.js` is missing `poolId` or `clientId`, or the specified `authenticationFlowType` is invalid.
fix
Verify that `ENV.cognito.poolId` and `ENV.cognito.clientId` are correctly set in `config/environment.js`. Check the `authenticationFlowType` against allowed values (`USER_SRP_AUTH | USER_PASSWORD_AUTH`).
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
ember-simple-authrequiredCore authentication library that ember-cognito extends.
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources