{"id":20904678,"url":"https://github.com/sage/omniauth-cognito-idp","last_synced_at":"2025-10-31T01:31:54.420Z","repository":{"id":45837771,"uuid":"118744719","full_name":"Sage/omniauth-cognito-idp","owner":"Sage","description":"OmniAuth Strategy for AWS Cognito in Ruby","archived":false,"fork":false,"pushed_at":"2024-08-15T01:40:59.000Z","size":25,"stargazers_count":35,"open_issues_count":5,"forks_count":13,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-02-16T04:28:21.775Z","etag":null,"topics":["omniauth-strategy","ruby","rubygem"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-24T09:43:20.000Z","updated_at":"2024-06-28T14:47:20.000Z","dependencies_parsed_at":"2024-11-18T13:20:26.893Z","dependency_job_id":"8c4dec56-e79e-4849-8679-60a7fd551cfb","html_url":"https://github.com/Sage/omniauth-cognito-idp","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.25,"last_synced_commit":"9881dbc0b47e417f7d75f742c7a12a9ea07d7894"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fomniauth-cognito-idp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fomniauth-cognito-idp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fomniauth-cognito-idp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fomniauth-cognito-idp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sage","download_url":"https://codeload.github.com/Sage/omniauth-cognito-idp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239088382,"owners_count":19579434,"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":["omniauth-strategy","ruby","rubygem"],"created_at":"2024-11-18T13:18:28.429Z","updated_at":"2025-10-31T01:31:54.127Z","avatar_url":"https://github.com/Sage.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# omniauth-cognito-idp\n\n[![Build Status](https://travis-ci.org/Sage/omniauth-cognito-idp.svg?branch=master)](https://travis-ci.org/Sage/omniauth-cognito-idp)\n[![Maintainability](https://api.codeclimate.com/v1/badges/fc91c64f9d7b63724714/maintainability)](https://codeclimate.com/github/Sage/omniauth-cognito-idp/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/fc91c64f9d7b63724714/test_coverage)](https://codeclimate.com/github/Sage/omniauth-cognito-idp/test_coverage)\n[![Gem Version](https://badge.fury.io/rb/omniauth-cognito-idp.svg)](https://badge.fury.io/rb/omniauth-cognito-idp)\n\nThis is an [OmniAuth](https://github.com/omniauth/omniauth) strategy based on\n[omniauth-oauth2](https://github.com/omniauth/omniauth-oauth2) for authenticating against the\n[Amazon Cognito IdP](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html).\n\n## Setup\n\n### Cognito User Pool\n\nThe User Pool needs to have a domain assigned. You also have to create a client application for the User Pool. The\nclient application should have a secret.\n\n### Ruby Application\n\nAdd the gem to your bundle as usual. Then, OmniAuth is used as Rack middleware:\n\n```ruby\n# for instance, in config.ru\nrequire 'omniauth-cognito-idp'\n\nuse Rack::Session::Cookie # OmniAuth requires session support\n\nuse OmniAuth::Strategies::CognitoIdP,\n  ENV['CLIENT_ID'],\n  ENV['CLIENT_SECRET'],\n  client_options: {\n    site: ENV['COGNITO_USER_POOL_SITE']\n  },\n  scope: 'email openid aws.cognito.signin.user.admin profile',\n  user_pool_id: ENV['COGNITO_USER_POOL_ID'],\n  aws_region: ENV['AWS_REGION']\n\nrun MyApplication\n```\n\nThe following configuration options are available:\n\n1. `client_options` (required)\n\n   This is a Hash that is used to configure the OAuth2 client. You have to include the `site` key and specify the domain\n   you assigned to the Cognito User Pool.\n2. `scope` (required)\n\n   A space separated list of scopes you want to request. Make sure to include `openid` and some openid attributes if you\n   want to get an ID token (which gives you information about the user without additional request). When you include\n   `aws.cognito.signin.user.admin`, you can use the access token to get or update the user's attributes in the\n   User Pool.\n   \n   See https://docs.aws.amazon.com/cognito/latest/developerguide/authorization-endpoint.html\n3. `user_pool_id` (optional)\n\n   When specified together with `aws_region`, the ID token returned by Cognito will be verified to really belong to the\n   User Pool you expect.\n4. `aws_region` (optional)\n   When specified together with `user_pool_id`, the ID token returned by Cognito will be verified to really belong to\n   the given AWS region.\n5. `jwt_leeway` (optional)\n\n   Each JWT has it's own expiration and do not use before dates. As the issuer's clock might be off a bit from your's,\n   you can allow some leeway for the JWT validation. Must be a positive integer. Default is 60 seconds. \n\n## Development\n\nThe repository contains a small Sinatra application that can be used to test the strategy. Just run `rackup` with the\nfollowing ENV variables set:\n\n* `COGNITO_CLIENT_ID`: The id of the client application\n* `COGNITO_CLIENT_SECRET`: The client application's secret\n* `COGNITO_POOL_SITE`: The domain attached to the user pool.\n\nThe application will start at `http://localhost:8678`. You will have to add a callback URL\n`http://localhost:8678/auth/cognito-idp/callback` to the client application in the AWS Console. The test app stores the\ntokens in memory, so you will need to sign in again after restarting the server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage%2Fomniauth-cognito-idp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsage%2Fomniauth-cognito-idp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage%2Fomniauth-cognito-idp/lists"}