{"id":15561846,"url":"https://github.com/jcmfernandes/omniauth-workos","last_synced_at":"2025-04-23T22:54:11.970Z","repository":{"id":56886661,"uuid":"461873643","full_name":"jcmfernandes/omniauth-workos","owner":"jcmfernandes","description":"An OmniAuth strategy for authenticating with WorkOS.","archived":false,"fork":false,"pushed_at":"2022-10-23T18:13:23.000Z","size":24,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T22:53:47.859Z","etag":null,"topics":["devise","oauth","omniauth","omniauthable","ruby","saml","workos"],"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/jcmfernandes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-21T13:27:45.000Z","updated_at":"2025-04-07T08:12:21.000Z","dependencies_parsed_at":"2022-08-20T14:31:26.555Z","dependency_job_id":null,"html_url":"https://github.com/jcmfernandes/omniauth-workos","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmfernandes%2Fomniauth-workos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmfernandes%2Fomniauth-workos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmfernandes%2Fomniauth-workos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmfernandes%2Fomniauth-workos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcmfernandes","download_url":"https://codeload.github.com/jcmfernandes/omniauth-workos/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250528699,"owners_count":21445511,"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":["devise","oauth","omniauth","omniauthable","ruby","saml","workos"],"created_at":"2024-10-02T16:10:21.669Z","updated_at":"2025-04-23T22:54:11.952Z","avatar_url":"https://github.com/jcmfernandes.png","language":"Ruby","readme":"# OmniAuth WorkOS Strategy\n\nAn OmniAuth strategy for authenticating with [WorkOS](https://workos.com). This strategy is based on the [OmniAuth OAuth2 strategy](https://github.com/omniauth/omniauth-oauth2).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'omniauth-workos'\n```\n\nIf you're using this strategy with Rails, also add the following for CSRF protection:\n\n```ruby\ngem 'omniauth-rails_csrf_protection'\n```\n\nAnd then execute:\n\n    $ bundle install\n\n## Usage\n\nTo start processing authentication requests, the following steps must be performed:\n\n1. Initialize the strategy\n2. Configure the callback controller\n3. Add the required routes\n4. Trigger an authentication request\n\n### Authentication hash\n\nThe WorkOS strategy will provide the standard OmniAuth hash attributes:\n\n- `:provider` - the name of the strategy, in this case `workos`\n- `:uid` - the user identifier\n- `:info` - the user's profile ([can be filtered](#filter-info-fields))\n- `:credentials` - token requested and data\n\n```ruby\n{\n  :provider =\u003e \"workos\",\n  :uid =\u003e \"prof_01DMC79VCBZ0NY2099737PSVF1\",\n  :info =\u003e {\n    :connection_id =\u003e \"conn_01E4ZCR3C56J083X43JQXF3JK5\",\n    :organization_id =\u003e \"org_01EHWNCE74X7JSDV0X3SZ3KJNY\",\n    :connection_type =\u003e \"okta\",\n    :email =\u003e \"todd@foo-corp.com\",\n    :name =\u003e \"Todd Rundgren\",\n    :first_name =\u003e \"Todd\",\n    :idp_id =\u003e \"00u1a0ufowBJlzPlk357\",\n    :last_name =\u003e \"Rundgren\",\n    :object =\u003e \"profile\",\n    :raw_attributes\" =\u003e {...}\n  },\n  :credentials =\u003e {\n    :token =\u003e \"ACCESS_TOKEN\",\n    :expires_at =\u003e 1485373937,\n    :expires =\u003e true\n  }\n}\n```\n\n#### Filter info fields\n\nTo filter the fields in the `info` object, you can specify them when you register the provider:\n\n```ruby\nprovider\n  :workos,\n  ENV['WORKOS_CLIENT_ID'],\n  ENV['WORKOS_CLIENT_SECRET'],\n  ENV['WORKOS_DOMAIN'],\n  {\n    info_fields: %w[email first_name]\n  }\n```\n\nPossible values are:\n- `\"all\"` (default) - don't filter, that is, include all fields\n- `%w[...]` (an array of **strings**) - the fields to include\n\nNote: field `\"name\"` will always be included.\n\n### Query parameter options\n\nIn some scenarios, you may need to pass specific query parameters to `/sso/authorize`. The following parameters are available to enable this:\n\n- `connection`\n- `organization`\n- `provider`\n- `login_hint`\n\nRefer to the [documentation](https://workos.com/docs/reference/sso/authorize/get#authorize-get-endpoint) to see when and how to use them.\n\nSimply pass these query parameters to your OmniAuth redirect endpoint to enable their behavior.\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/jcmfernandes/omniauth-workos.\n\n## License\n\nReleased under the MIT License. See [{file:LICENSE}](LICENSE).\n\nCopyright (c) 2022, João Fernandes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcmfernandes%2Fomniauth-workos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcmfernandes%2Fomniauth-workos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcmfernandes%2Fomniauth-workos/lists"}