{"id":16803,"library":"ember-cognito","title":"Ember Cognito Integration","description":"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.","status":"active","version":"4.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/adopted-ember-addons/ember-cognito","tags":["javascript","ember-addon","cognito"],"install":[{"cmd":"npm install ember-cognito","lang":"bash","label":"npm"},{"cmd":"yarn add ember-cognito","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-cognito","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core authentication library that ember-cognito extends.","package":"ember-simple-auth","optional":false}],"imports":[{"note":"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.","wrong":"import { Cognito } from 'ember-cognito/authenticators/cognito';","symbol":"Cognito Authenticator","correct":"import Authenticator from 'ember-cognito/authenticators/cognito';"},{"note":"The cognito service is typically injected using the @service decorator in Ember components or controllers, rather than direct import.","wrong":"import { cognito } from 'ember-cognito/services/cognito';","symbol":"Cognito Service","correct":"import { service } from '@ember/service'; class MyComponent { @service cognito; }"},{"note":"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.","symbol":"emberCognitoRegistry","correct":"import emberCognitoRegistry from 'ember-cognito/registry';"}],"quickstart":{"code":"import Component from '@ember/component';\nimport { action } from '@ember/object';\nimport { service } from '@ember/service';\nimport { tracked } from '@glimmer/tracking';\n\n// Ensure your config/environment.js has:\n// cognito: {\n//   poolId: \"<your Cognito User Pool ID>\",\n//   clientId: \"<your Cognito App Client ID>\",\n// },\n\nexport default class LoginComponent extends Component {\n  @service session;\n  @tracked username = '';\n  @tracked password = '';\n  @tracked errorMessage = '';\n\n  @action\n  updateUsername(event) {\n    this.username = event.target.value;\n  }\n\n  @action\n  updatePassword(event) {\n    this.password = event.target.value;\n  }\n\n  @action\n  async authenticate() {\n    this.errorMessage = ''; // Clear previous errors\n    try {\n      await this.session.authenticate('authenticator:cognito', {\n        username: this.username,\n        password: this.password\n      });\n      // Authentication successful, redirect or update UI\n      console.log('User authenticated successfully!');\n    } catch (error) {\n      this.errorMessage = error.message || String(error);\n      console.error('Authentication error:', this.errorMessage);\n    }\n  }\n\n  // Example of using the cognito service for signup\n  @service cognito;\n  @tracked signUpUsername = '';\n  @tracked signUpPassword = '';\n  @tracked signUpEmail = '';\n  @tracked signUpSuccess = false;\n\n  @action\n  async signUp() {\n    this.errorMessage = '';\n    try {\n      await this.cognito.signUp(\n        this.signUpUsername,\n        this.signUpPassword,\n        { email: this.signUpEmail }\n      );\n      this.signUpSuccess = true;\n      console.log('Sign-up successful, check email for confirmation code.');\n    } catch (error) {\n      this.errorMessage = error.message || String(error);\n      console.error('Sign-up error:', this.errorMessage);\n    }\n  }\n}","lang":"typescript","description":"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."},"warnings":[{"fix":"Add `import emberCognitoRegistry from 'ember-cognito/registry';` and then spread `...emberCognitoRegistry()` (or `...emberCognitoRegistry('name-of-app')` for `ember-resolver`) into your `modules` configuration.","message":"Version 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.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Consult the AWS Amplify v6 migration guide and update any direct Amplify interactions in your application code.","message":"`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.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade your Node.js environment to version 16 or newer.","message":"Version 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.","severity":"breaking","affected_versions":">=2.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.","message":"In 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).","severity":"breaking","affected_versions":">=2.0.0"},{"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.","message":"Version 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.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"When configuring your Cognito User Pool App Client in AWS, ensure the 'Generate client secret' checkbox is unchecked.","message":"The 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.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"In your `ember-cli-build.js` or `app.js`, add `import emberCognitoRegistry from 'ember-cognito/registry';` and spread `...emberCognitoRegistry()` into your `modules` configuration.","cause":"Attempting to build or run an Ember application using `ember-cognito` v4.x without configuring the v2 addon registry.","error":"Could not find module `ember-cognito/registry`"},{"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.","cause":"Your application has `ember-cognito` installed (>=v2.0.0) but is missing `ember-simple-auth` as a direct dependency or has an incompatible version.","error":"Error: Cannot find module 'ember-simple-auth/mixins/data-adapter-mixin'"},{"fix":"Upgrade your Node.js environment to version 16 or newer.","cause":"Running an Ember CLI project with `ember-cognito` v2.0.0 or higher on an unsupported Node.js version.","error":"Node.js vX.Y.Z is not supported. Please use Node.js v16 or higher."},{"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`).","cause":"The `cognito` configuration in `config/environment.js` is missing `poolId` or `clientId`, or the specified `authenticationFlowType` is invalid.","error":"Missing credentials in config or authentication flow type"}],"ecosystem":"npm","meta_description":null}