{"id":26091665,"url":"https://github.com/intercom/omniauth-intercom","last_synced_at":"2025-10-24T18:42:01.107Z","repository":{"id":49040277,"uuid":"57977214","full_name":"intercom/omniauth-intercom","owner":"intercom","description":"Intercom strategy for OmniAuth","archived":false,"fork":false,"pushed_at":"2025-02-13T10:03:13.000Z","size":42,"stargazers_count":6,"open_issues_count":4,"forks_count":7,"subscribers_count":150,"default_branch":"master","last_synced_at":"2025-04-12T06:43:22.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/intercom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-03T14:49:56.000Z","updated_at":"2025-02-13T10:03:10.000Z","dependencies_parsed_at":"2022-09-08T15:12:34.749Z","dependency_job_id":null,"html_url":"https://github.com/intercom/omniauth-intercom","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fomniauth-intercom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fomniauth-intercom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fomniauth-intercom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fomniauth-intercom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intercom","download_url":"https://codeload.github.com/intercom/omniauth-intercom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530610,"owners_count":21119592,"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":[],"created_at":"2025-03-09T10:22:49.766Z","updated_at":"2025-10-24T18:41:56.050Z","avatar_url":"https://github.com/intercom.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OmniAuth Intercom\n\nIntercom OAuth2 Strategy for OmniAuth.\n\nSupports the OAuth 2.0 server-side and client-side flows. Read the [Intercom OAuth docs](https://developers.intercom.io/reference#oauth) for more details:\n\n## Installing\n\nAdd to your `Gemfile`:\n\n```ruby\ngem 'omniauth-intercom', '~\u003e 0.1.9'\n```\n\nThen `bundle install`.\n\n## Usage\n\n**Important** For this to work you need to select the `read_single_admin` permissions in your OAuth application to use this middleware.   \n**Important** You will also need to ensure your `redirect_url` is set to `/auth/intercom/callback`\n\n`OmniAuth::Strategies::Intercom` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.\n\nHere's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:\n\n```ruby\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider :intercom, ENV['INTERCOM_KEY'], ENV['INTERCOM_SECRET']\nend\n```\nTo start the authentication process with Intercom you simply need to access `/auth/intercom` route.\nYou can start the authentication process directly with the signup page by accessing `/auth/intercom?signup=1`\n\n**Important** Reminder: As noted earlier you need the `read_single_admin` permissions to use this middleware.   \n**Important** Reminder: As noted earlier your `redirect_url` should be `/auth/intercom/callback`\n\nBy default Intercom strategy rejects users with unverified email addresses. `info` and `raw_info` in `request.env['omniauth.auth']` will not be populated in that case.\nTo disable this check add `verify_email: false` to your config:\n\n```ruby\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider :intercom, ENV['INTERCOM_KEY'], ENV['INTERCOM_SECRET'], verify_email: false\nend\n```\n\n## Auth Hash\n\nHere's an example *Auth Hash* available in `request.env['omniauth.auth']`:\n\n```ruby\n{\n  :provider =\u003e 'intercom',\n  :uid =\u003e '342324',\n  :info =\u003e {\n    :email =\u003e 'kevin.antoine@intercom.io',\n    :name =\u003e 'Kevin Antoine'\n  },\n  :credentials =\u003e {\n    :token =\u003e 'dG9rOmNdrWt0ZjtgzzE0MDdfNGM5YVe4MzsmXzFmOGd2MDhiMfJmYTrxOtA=', # OAuth 2.0 access_token, which you may wish to store\n    :expires =\u003e false\n  },\n  :extra =\u003e {\n    :raw_info =\u003e {\n      :name =\u003e 'Kevin Antoine',\n      :email =\u003e 'kevin.antoine@intercom.io',\n      :type =\u003e 'admin',\n      :id =\u003e '342324',\n      :email_verified =\u003e true,\n      :app =\u003e {\n        :id_code =\u003e 'abc123', # Company app_id\n        :type =\u003e 'app',\n        :secure =\u003e true, # Secure mode enabled for this app\n        :timezone =\u003e \"Dublin\",\n        :name =\u003e \"ProjectMap\"\n      },\n      :avatar =\u003e {\n        :image_url =\u003e \"https://static.intercomassets.com/avatars/343616/square_128/me.jpg?1454165491\"\n      }\n    }\n  }\n}\n```\n\n### Intercom Button / Popup authentication\n\nTo use `Intercom Button` to display authentication in a popup it is simple :\n\n- Add the following code in the html file in which you want to start to authenticate with Intercom ( `/views/home/index.html.erb` if you want to authenticate with Intercom in `home#index`)\n\n```html\n\u003ca href=\"javascript:void(0)\" class=\"intercom-oauth-cta\"\u003e\n  \u003cimg src=\"https://static.intercomassets.com/assets/oauth/primary-7edb2ebce84c088063f4b86049747c3a.png\" srcset=\"https://static.intercomassets.com/assets/oauth/primary-7edb2ebce84c088063f4b86049747c3a.png 1x, https://static.intercomassets.com/assets/oauth/primary@2x-0d69ca2141dfdfa0535634610be80994.png 2x, https://static.intercomassets.com/assets/oauth/primary@3x-788ed3c44d63a6aec3927285e920f542.png 3x\"/\u003e\n\u003c/a\u003e\n\u003cscript type=\"text/javascript\"\u003e\n$('.intercom-oauth-cta').unbind('click').click(function() {\n\tvar auth_window = window.open('/auth/intercom', 'Sign in', 'width=700,height=450');\n\tvar checkWindow = function() {\n\t  if (auth_window.closed) {\n      window.location = '/';\n\t  } else if (window.oauth_success === undefined) {\n\t    setTimeout(checkWindow, 200);\n    }\n\t};\n  checkWindow();\n});\n\u003c/script\u003e\n```\n\nCreate a `views/home/intercom_callback.html.erb` file ( if your callback route is `home#intercom_callback`)\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eAuthorized\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cscript type=\"text/javascript\"\u003e\n      setTimeout(function() {\n        if (window.opener) {\n          window.opener.oauth_success = true;\n        }\n        window.close();\n      }, 1000);\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n### Example application\n\n[testapp-intercom-omniauth](https://github.com/Skaelv/testapp-intercom-omniauth) is a simple application implementing the authentication process with Intercom with a popup display.\n\n## Troubleshooting\n\n#### omniauth-oauth2 dependency in v0.1.4\n\nFrom v0.1.4 we have defined our `omniauth-oauth2` dependency to allow any version from 1.2 on. If you relied on our Gemspec version config for `omniauth-oauth2` you can simply add `gem 'omniauth-oauth2', '~\u003e 1.2'` to your Gemfile. This will ensure your `omniauth-oauth2` version is `1.2.x` again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintercom%2Fomniauth-intercom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintercom%2Fomniauth-intercom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintercom%2Fomniauth-intercom/lists"}