{"id":20982094,"url":"https://github.com/ayerdines/omniauth-cognito","last_synced_at":"2026-04-21T18:35:06.855Z","repository":{"id":208458977,"uuid":"721591143","full_name":"ayerdines/omniauth-cognito","owner":"ayerdines","description":"Omniauth strategy for Amazon Cognito with OAuth 2.0 authorization code grant","archived":false,"fork":false,"pushed_at":"2023-11-22T03:47:52.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T05:05:50.967Z","etag":null,"topics":["amazon-cognito","saml-sso","saml2","single-sign-on","sso"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ayerdines.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-21T11:28:50.000Z","updated_at":"2024-02-10T04:09:00.000Z","dependencies_parsed_at":"2023-11-21T16:51:01.790Z","dependency_job_id":null,"html_url":"https://github.com/ayerdines/omniauth-cognito","commit_stats":null,"previous_names":["ayerdines/omniauth-cognito"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayerdines%2Fomniauth-cognito","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayerdines%2Fomniauth-cognito/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayerdines%2Fomniauth-cognito/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayerdines%2Fomniauth-cognito/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayerdines","download_url":"https://codeload.github.com/ayerdines/omniauth-cognito/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243384632,"owners_count":20282411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-cognito","saml-sso","saml2","single-sign-on","sso"],"created_at":"2024-11-19T05:44:22.911Z","updated_at":"2025-12-24T18:47:09.700Z","avatar_url":"https://github.com/ayerdines.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OmniAuth Cognito OAuth2 Strategy\n\nOmniAuth Strategy to authenticate with Cognito via OAuth2 using authorization code grant.\n\n## Installation\nInstall the gem and add to the application's Gemfile by executing:\n\n```shell\nbundle add omniauth-cognito\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n```shell\ngem install omniauth-cognito\n```\n\n## Usage\n\n### Devise\nAdd the following to `config/initializers/devise.rb`:\n\n```ruby\nconfig.omniauth :cognito,\n  ENV['COGNITO_CLIENT_ID'],\n  ENV['COGNITO_CLIENT_SECRET'],\n  scope: 'openid email profile phone aws.cognito.signin.user.admin',\n  client_options: {\n    site: ENV['COGNITO_DOMAIN']\n  }\n```\n\n### OmniAuth\nAdd the following to `config/initializers/omniauth.rb`:\n\n```ruby\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider :cognito,\n    ENV['COGNITO_CLIENT_ID'],\n    ENV['COGNITO_CLIENT_SECRET'],\n    scope: 'openid email profile phone aws.cognito.signin.user.admin',\n    client_options: {\n      site: ENV['COGNITO_DOMAIN']\n    }\nend\n```\n\nNote: For app without client secret (e.g. SPA), use `nil` in place of `ENV['COGNITO_CLIENT_SECRET']`\n\nThen add the following to `config/routes.rb` so the callback routes are defined.\n\n```ruby\ndevise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }\n```\n\nMake sure your model is omniauthable. Generally this is `app/models/user.rb`\n\n```ruby\ndevise :omniauthable, omniauth_providers: [:cognito]\n```\n\n### Auth Hash\nHere's an example of auth hash you available in the callback, which can be accessed as `request.env['omniauth.auth']`:\n\n```json\n{\n  \"provider\": \"cognito\",\n  \"uid\": \"1cb40fcd-756d-4388-beb3-ab241e8ede84\",\n  \"info\": {\n    \"name\": \"Dinesh Budhayer\",\n    \"email\": \"budhayer96d@gmail.com\",\n    \"first_name\": \"Dinesh\",\n    \"last_name\": \"Budhayer\",\n    \"preferred_username\": null,\n    \"phone_number\": null,\n    \"phone_number_verified\": null,\n    \"email_verified\": \"true\"\n  },\n  \"credentials\": {\n    \"token\": \"ACCESS_TOKEN\",\n    \"refresh_token\": \"REFRESH_TOKEN\",\n    \"expires_at\": 1700586000,\n    \"expires\": true\n  },\n  \"extra\": {}\n}\n```\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ayerdines/omniauth-cognito. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/omniauth-cognito/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Omniauth::Cognito project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/omniauth-cognito/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayerdines%2Fomniauth-cognito","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayerdines%2Fomniauth-cognito","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayerdines%2Fomniauth-cognito/lists"}