{"id":26686142,"url":"https://github.com/actmd/omniauth-smart","last_synced_at":"2025-03-26T11:16:57.498Z","repository":{"id":52416343,"uuid":"100725011","full_name":"actmd/omniauth-smart","owner":"actmd","description":"Omniauth strategy supporting the SMART protocol","archived":false,"fork":false,"pushed_at":"2023-01-26T19:27:02.000Z","size":34,"stargazers_count":0,"open_issues_count":7,"forks_count":3,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2024-04-14T04:50:01.733Z","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/actmd.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2017-08-18T15:20:03.000Z","updated_at":"2019-10-22T20:02:21.000Z","dependencies_parsed_at":"2023-02-14T22:16:41.890Z","dependency_job_id":null,"html_url":"https://github.com/actmd/omniauth-smart","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actmd%2Fomniauth-smart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actmd%2Fomniauth-smart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actmd%2Fomniauth-smart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actmd%2Fomniauth-smart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actmd","download_url":"https://codeload.github.com/actmd/omniauth-smart/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245641437,"owners_count":20648644,"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-26T11:16:56.805Z","updated_at":"2025-03-26T11:16:57.491Z","avatar_url":"https://github.com/actmd.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Omniauth::Smart\n\nThis is an [OmniAuth](https://github.com/omniauth/omniauth) strategy for authenticating using the [SMART on FHIR](https://smarthealthit.org) protocol.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'omniauth-smart'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install omniauth-smart\n\n## Usage\n\nThis project is in *DEVELOPMENT STATUS* and has not been verified to be free of bugs, security issues, etc. Feel free to use this gem as part of your internal projects and/or testing, however ACT.md *DOES NOT* claim any responsibility for any issues that may arise from using this gem. As such, use at your own risk and we advise not to use it in a production setting or anywhere where it may compromise any data.\n\n## Register your application\n\nSMART is designed to allow your application to be launched from within an electronic medical record. To properly ensure that your SMART application is working, you will need\n\n * an issuer URL: this is the URI of the site that will launch your application (for testing purposes you will be using a SMART sandbox)\n * client id : this will be a GUID that uniquely identifies your application\n * client secret : this will be a secret known only to your app and the SMART server. This is not always required (say for javascript in browser apps), but since this is a server version and can keep a secret, we recommend using it\n\nYou also need to specify an \"org id\" which will be a unique value passed back to your application that links this launch to an organization in your application (to support multi-tenant applications).\n\n## SMART Sandboxes\n\n* [SMART Sandbox](http://docs.smarthealthit.org/sandbox/)\n* [Healthcare Services Platform Consortium](https://sandbox.hspconsortium.org/#/start)\n\n[Cerner](code.cerner.com) and [Epic](open.epic.com) also offer test environments.\n\n## Rails\n\nAdd this as a provider to config/initializers/omniauth.rb\n\nNote: here we are using a simple array backend, but feel free to create your own backend.\n\n```ruby\nrequire 'omniauth/smart/backend'\nrequire 'omniauth/smart/client'\n\nOmniAuth.config.logger = Rails.logger\n\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider(\n      :smart,\n      backend: OmniAuth::Smart::BackendArray.new(\n          [\n              OmniAuth::Smart::Client.new(\n                  issuer: \"ISSUER_URI\",\n                  client_id: ENV[\"CLIENT_ID\"],\n                  client_secret: ENV[\"CLIENT_SECRET\"]\n                  org_id: ENV[\"ORG_ID\"])\n          ]\n      ),\n      callback_url: \"/auth/smart/callback\"\n  )\nend\n```\n\n### Update your routes\n\nOmniAuth will register rack routes /auth/smart and /auth/smart/callback\n\nTo get information about failures, you should register a failure method\n\n```ruby\n  get '/auth/failure'        =\u003e 'sessions#failure'\n```\n\nThe OmniAuth /auth/smart/callback will initiate the request phase. Once it is done, it will then direct to your route for this, so you should also register a method for the callback.\n\n```ruby\n  get '/auth/smart/callback' =\u003e 'sessions#smart_callback'\n```\n\n### Handling the callback\n\nIn your sessions controller, require the OmniauthSmartHash so it is easier for you to parse the returned results.\n\n```ruby\nrequire 'omniauth/smart/hash'\n```\n\nThen setup your callback method.\n\n\n```ruby\n  def smart_callback\n    # 1. get provider identifier from omniauth\n    smart = OmniAuth::Smart::Hash.new(request.env['omniauth.auth'])\n    # do interesting things with the provider info, the patient context and the FHIR endpoint and token you just got!\n  end\n```\n\n## FAQ\n\n### What is the date time format for expiry dates in the token returned?\n\nExpires at is a NumericDate \"seconds since Epoch\" http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#rfc.section.4.1.4\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/actmd/omniauth-smart.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factmd%2Fomniauth-smart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factmd%2Fomniauth-smart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factmd%2Fomniauth-smart/lists"}