multi_auth icon indicating copy to clipboard operation
multi_auth copied to clipboard

Allow custom providers

Open katafrakt opened this issue 4 years ago • 3 comments

Some time ago I forked multi_auth, wanting to add Spotify support. But then I realized that maybe it's better to just allow developer to add their own provider, without the need to fork the project.

The outline commit for that is here: https://github.com/katafrakt/multi_auth/commit/78ab47533cdf9d50ead4f3f52afcb8e6695a94de Of course, this still requires testing and documentation, at least. I can do that and prepare a pull request, but since it's a new feature, I wanted to discuss it first.

katafrakt avatar Oct 03 '20 08:10 katafrakt

I like it, hope compiler will embed only used providers. What about syntax like this:

MultiAuth.config(MultiAuth::Facebook, ENV['ID'], ENV['SECRET'])

And for backward compatibility this one

MultiAuth.config("facebook", ENV['ID'], ENV['SECRET'])

What about add Spotify to this repo too? I think compiler will be smart to include Spotify only when used

msa7 avatar Oct 04 '20 18:10 msa7

I really like your API suggestions! Will do it like that. I hope I'll be able to work on that next week.

And sure, I can add Spotify integration too.

katafrakt avatar Oct 08 '20 21:10 katafrakt

Hi,

I also asked myself the question on my side and I thought about this kind of config file

oauth:
  url: api.oauth_provider.com"
  key: 123
  secret: 456
  authorize_uri: "/oauth/authorize"
  token_uri: "/oauth/token"
user_field:
  provider: "custom"
  uid: id
  name: name
  email: email
  nickname: username
  first_name: nil
  last_name: nil
  location: location
  description: bio
  image: image_url
  phone: nil
  url:
    web_url: web_url

JadeKharats avatar Oct 09 '20 07:10 JadeKharats