Log in with custom OAuth2 Server

License Latest Stable Version Total Downloads

A Flarum extension. Generic oauth provider for Flarum

Features

Adds a Generic provider to FoF OAuth to enable Login with <your custom provider> functionality.

Installation

Install with composer:

composer require blt950/oauth-generic

Configuration

Admin Panel

Example configuration, please consult your provider for the correct values.

  • Client ID <id from your provider>
  • Client Secret <secret from your provider>
  • Scope <scope from your provider> or empty
  • Authorization Endpoint https://yourprovider.com/oauth/authorize
  • Token Endpoint https://yourprovider.com/oauth/token
  • User Information Endpoint https://yourprovider.com/api/user

To correctly find your user fields that might be nested in arrays, the parameters support nesting such as:

  • User ID data-id
  • Username data-username
  • Email data-personal-email

Forcing or suggesting fields gives you the possiblity to force or pre-fill a suggested value when signing up the user.

  • Force User ID 1 or 0.
  • Force Display Name 1 or 0.
  • Force Email 1 or 0.

Provider Name

If you wish to change the name of provider you can do so by editing the locale file. I did not find a way to make this dynamic.

Updating

composer update blt950/oauth-generic
php flarum cache:clear

Requests and Issues

Please file a pull request if you find issues or want to expand the functionality. Thank you for contributing.

Known quirks and bugs

  • The nickname input field in signup modal fills in username regardless of display name is provided. This is due to get fixed in this pull request for a future Flarum version
  • The icon of provider in admin panel is invisible due to FoF OAuth plugin forces a font-weight that won't display the font, it shows correctly other places though.
  • The force settings are a boolean but have a string input, simply because boolean values are not supported for provider settings.

Links

    Nice!

    blt950 A Flarum extension. Reddit oauth provider for Flarum

    This probably needs to read something else 🙈

      luceos
      Haha, whoops! That's what I get for copying. I've corrected it now 😃

      7 days later

      Hi fellas, I got a question, i wanted to keep all users on a flarum forum (url is xxx.com/board) as it is , including registration and sign in, but all my users on a wordpress website (url is xxx.com) will be from this flarum forum automatically.
      All users can register on the flarum forum and disable wordpress site's registration, will this extension do the job? Any help will be highly appreciated, thank you!

        Mikenthuzi

        If I understand your question correctly, you want users to signup at Flarum and then login at Wordpress using Flarum-user. To accomplish something like that you'd need to turn Flarum into a OAuth2 server and then use a OAuth2 client on Wordpress.

        This plugin will not help you to accomplish this. I don't use Wordpress so I can't really help you further either. Best of luck 🙂

          blt950 That's what i was trying to say.

          blt950 To accomplish something like that you'd need to turn Flarum into a OAuth2 server and then use a OAuth2 client on Wordpress.

          it helps, thank you.

          This seems quite useful.

          Could you explain a bit better how to change the name of the button via the locale file? Is it possible to customized the icon as well?

          Thanks!

            6 days later