All Projects → mastodon → omniauth-mastodon

mastodon / omniauth-mastodon

Licence: other
OmniAuth strategy for Mastodon

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to omniauth-mastodon

Devise token auth
Token based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth.
Stars: ✭ 3,263 (+11985.19%)
Mutual labels:  oauth, omniauth
jax-rs-pac4j
Security library for JAX-RS and Jersey
Stars: ✭ 48 (+77.78%)
Mutual labels:  oauth
vue-socials
💬 Social media share buttons and counts for Vue.js
Stars: ✭ 32 (+18.52%)
Mutual labels:  mastodon
oidc
Easy to use OpenID Connect client and server library written for Go and certified by the OpenID Foundation
Stars: ✭ 475 (+1659.26%)
Mutual labels:  oauth
shopify-node-express-app
Simple Shopify app with Express and Node.js that connects to a Shopify store via OAuth.
Stars: ✭ 20 (-25.93%)
Mutual labels:  oauth
materialize-social
Social Login Buttons for MaterializeCSS
Stars: ✭ 50 (+85.19%)
Mutual labels:  oauth
cli-cube-timer
Time your solves, without leaving the terminal
Stars: ✭ 19 (-29.63%)
Mutual labels:  oauth
omniauth-kerberos
OmniAuth strategy for kerberos authentication.
Stars: ✭ 13 (-51.85%)
Mutual labels:  omniauth
mastodon-to-twitter
Mas2tter - the Mastodon-to-Twitter Mirrorbot
Stars: ✭ 22 (-18.52%)
Mutual labels:  mastodon
mastible
An Ansible playbook to install Mastodon
Stars: ✭ 17 (-37.04%)
Mutual labels:  mastodon
soundstorm
The Federated Social Audio Platform
Stars: ✭ 26 (-3.7%)
Mutual labels:  mastodon
okta-microservice-security-examples
Demos from Oktane18: API and Microservices Best Practices
Stars: ✭ 17 (-37.04%)
Mutual labels:  oauth
django-rest-framework-oauth
OAuth support for Django REST Framework
Stars: ✭ 52 (+92.59%)
Mutual labels:  oauth
MstdnTimelinePreviewCard
mastodonのTLにPreviewCardを表示するやつ
Stars: ✭ 12 (-55.56%)
Mutual labels:  mastodon
indigenous-android
An open social app with support for IndieWeb, Mastodon, Pleroma and Pixelfed.
Stars: ✭ 89 (+229.63%)
Mutual labels:  mastodon
oauther
OAuth 1.0 for Elixir
Stars: ✭ 64 (+137.04%)
Mutual labels:  oauth
Mal4J
Java wrapper for the official MyAnimeList API
Stars: ✭ 23 (-14.81%)
Mutual labels:  oauth
masto.js
🐘 Mastodon API client for JavaScript, TypeScript, Node.js, browsers
Stars: ✭ 518 (+1818.52%)
Mutual labels:  mastodon
jfinal-justauth-demo
Jfinal集成JustAuth的demo
Stars: ✭ 26 (-3.7%)
Mutual labels:  oauth
ligh7hau5
A Matrix (https://matrix.org/docs/spec/) to Fediverse / ActivityPub client / bridge. Also, some media proxying.
Stars: ✭ 26 (-3.7%)
Mutual labels:  mastodon

OmniAuth::Mastodon

Gem Version

Authentication 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 we already have client credentials for that Mastodon instance.

Installation

gem 'mastodon-api', require: 'mastodon'
gem 'omniauth-mastodon'
gem 'omniauth'

Configuration

Example:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :mastodon, scope: 'read write follow', credentials: lambda { |domain, callback_url|
    Rails.logger.info "Requested credentials for #{domain} with callback URL #{callback_url}"

    existing = MastodonClient.find_by(domain: domain)
    return [existing.client_id, existing.client_secret] unless existing.nil?

    client = Mastodon::REST::Client.new(base_url: "https://#{domain}")
    app = client.create_app('OmniAuth Test Harness', callback_url)

    MastodonClient.create!(domain: domain, client_id: app.client_id, client_secret: app.client_secret)

    [app.client_id, app.client_secret]
  }
end

The 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].