Writing a strategy with a dynamic provider URL - Help

8 views
Skip to first unread message

Eugen Rochko

unread,
Oct 21, 2016, 7:56:28 PM10/21/16
to omniauth
Hello,

I need to write an OmniAuth strategy gem for my application, Mastodon. Mastodon is a federated microblogging engine with a REST API secured via OAuth2. In practice this means that if a user wants to login with a Mastodon account, we first need to know which Mastodon instance the user is from (e.g. mastodon.social, kickass.zone, etc). Then the application needs to check its DB to see if it already has a client ID/secret for that domain, and if not, request one via the API (this should be a step outside the strategy, I think, but somehow tied into it). Finally, the user must be redirected to the correct authorization URL of their domain with the correct client ID/secret for that domain.

I'm trying to use omniauth-oauth2 as base for the strategy, but I'm at a loss as to how the options on it should look and what I can do and how it will need to be instantiated. Please help!

Cheers,
Eugen
Reply all
Reply to author
Forward
0 new messages