{"id":15016646,"url":"https://github.com/mastodon/omniauth-mastodon","last_synced_at":"2025-03-29T11:30:57.861Z","repository":{"id":56886497,"uuid":"71639013","full_name":"mastodon/omniauth-mastodon","owner":"mastodon","description":"OmniAuth strategy for Mastodon","archived":false,"fork":false,"pushed_at":"2022-08-31T18:57:29.000Z","size":14,"stargazers_count":35,"open_issues_count":4,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T19:38:37.490Z","etag":null,"topics":["mastodon","oauth","omniauth","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mastodon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-22T12:54:46.000Z","updated_at":"2025-02-01T12:09:15.000Z","dependencies_parsed_at":"2022-08-20T14:31:23.295Z","dependency_job_id":null,"html_url":"https://github.com/mastodon/omniauth-mastodon","commit_stats":null,"previous_names":["gargron/omniauth-mastodon"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fomniauth-mastodon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fomniauth-mastodon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fomniauth-mastodon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fomniauth-mastodon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mastodon","download_url":"https://codeload.github.com/mastodon/omniauth-mastodon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246178340,"owners_count":20736126,"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":["mastodon","oauth","omniauth","rails","ruby"],"created_at":"2024-09-24T19:49:11.407Z","updated_at":"2025-03-29T11:30:57.514Z","avatar_url":"https://github.com/mastodon.png","language":"Ruby","readme":"OmniAuth::Mastodon\n==================\n\n[![Gem Version](http://img.shields.io/gem/v/omniauth-mastodon.svg)][gem]\n\n[gem]: https://rubygems.org/gems/omniauth-mastodon\n\nAuthentication strategy for federated Mastodon instances. This is just slightly more complicated than a traditional OAuth2 flow: We do not know the URL of the OAuth end-points in advance, nor can we be sure that\nwe already have client credentials for that Mastodon instance.\n\n## Installation\n\n    gem 'mastodon-api', require: 'mastodon'\n    gem 'omniauth-mastodon'\n    gem 'omniauth'\n\n## Configuration\n\nExample:\n\n```ruby\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider :mastodon, scope: 'read write follow', credentials: lambda { |domain, callback_url|\n    Rails.logger.info \"Requested credentials for #{domain} with callback URL #{callback_url}\"\n\n    existing = MastodonClient.find_by(domain: domain)\n    return [existing.client_id, existing.client_secret] unless existing.nil?\n\n    client = Mastodon::REST::Client.new(base_url: \"https://#{domain}\")\n    app = client.create_app('OmniAuth Test Harness', callback_url)\n\n    MastodonClient.create!(domain: domain, client_id: app.client_id, client_secret: app.client_secret)\n\n    [app.client_id, app.client_secret]\n  }\nend\n```\n\nThe only configuration key you need to set is a lambda for `:credentials`. That lambda will be called whenever we need to get client credentials for OAuth2 requests. The example above uses an ActiveRecord model to store client credentials for different Mastodon domains, and uses the `mastodon-api` gem to fetch them dynamically if they're not stored yet.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastodon%2Fomniauth-mastodon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastodon%2Fomniauth-mastodon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastodon%2Fomniauth-mastodon/lists"}