• Extensions
  • PHP and WordPress Single Sign On (SSO) with optional JWT Addon

maicol07 yay it worked 🌼

Edited

Hari i want my users to change their DP at flarum only .. if they change at wordpress i do not want that to reflect in flarum .. is that possible ?

is it possible ? or profile pic will sync automatically ? i dont want it to be synced

    Hari sorry, didn't see the edited message 😅
    With the latest WP plugin they will be automatically synced by default. However, this behaviour is toggoable in the plugin settings

    Hello, can I use your extension at freeflarum also? If so can you explain example setup? This is what I fill so far in extension setup:

    Registration URL: https://example.com/wp-login.php?action=register
    Login URL: https://example.com/wp-login.php?redirect_to=forum
    Logout URL: https://example.com/wp-login.php?action=logout
    Account URL: ???
    
    As for JWT part I have no idea how to fill issuer domain and signer key.
      9 days later

      maicol07 Is it ok to update the LoginMiddleware with the updated one for now or should I wait till the update?

        tharuka yes you can update manually the file as long as you are currently using 1.10

        [Community requested] PHP Version Drop Poll

        So I need the help of the community to decide if you want a PHP version drop and which version. So here is a poll. Click the option you would like to be the minimum PHP version required by the extension (and maybe also the plugins, check the other poll below).
        Obviously, the upgrade to a newer PHP version will include all the new features, where possible.

        Polls are in the next post!

        ⚠️ PHP 7.3 and future versions support notice

        Since there is someone who uses PHP 7.3, this is the future plans for PHP dropping:

        • First, I'll support PHP 7.3 (or any other version) until its EOL. Check it here
        • Second, if Flarum core changes PHP version before the EOL, I'll update too the version accordingly to what they have chosen.

        This notice concerns both extensions and plugins.

        Now, let's dive into the new release:

        1.10.1 - Flarum extension

        Released on June 12, 2021

        ⚡ Performance Improvements

        • b74c90c ⚡ Use dot notation to set array value

        🐛 Bug Fixes

        📝 Docs changes

        👷 Building scripts changes

        • 8f3d699 Allow to run changelog action manually to set the next version
        • 5cb1154 Add git credentials
        • a10765e Add missing commit
        • c009c2e Add missing token to push back changes
        • 8ab1c6f Push CHANGELOG.md back to repo
        • b705c4f Ensure changelog is saved to file
        • ec11208 Fix changelog action branch
        • 801fc90 Missing checkout action

        Other changes

        • 69b9e7e Added more author metadata to composer.json
        • fcd76e6 Added flarum version support badge
        • 5de2a76 deps: Moved JWT package to suggestions
        • 7a4ce8c locale: Delete pl.yml (#11)

          Hi @maicol07, once again, thank you very much for the SSO solution!

          One question/suggestion, when I use the SSO extension settings in Flarum administration, I disable login/signup links.
          However, when user is not logged in, I still have the big button "start a discussion" and when user clicks on it, it opens the login/signup popup window, not considering the SSO configuration > disable login/signup links.

          Would be great if flarum would consider the SSO settings.

            Hi! I recently updated to Flarum 1.0.2 and noticed 2 problems with the plugin.
            WP Plugin: v2.2
            SSO Flarum v1.10

            Fatal error when changing admin account info
            When I want to change the admin nickname or profile picture, I get the following error log:

            Got error 'PHP message: PHP Fatal error:  Uncaught GuzzleHttp\\Exception\\ClientException: Client error: 'PATCH https://forum-website.com/api/users/3' resulted in a '403 Forbidden' response:
            {"errors":[{"status":"403","code":"permission_denied"}]}
             in /home/[redacted]/webapps/[redacted]/wp-content/plugins/sso-flarum/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
            
            Stack trace:
            #0 /home/[redacted]/webapps/[redacted]/wp-content/plugins/sso-flarum/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\\Exception\\RequestException::create()
            #1 /home/[redacted]/webapps/[redacted]/wp-content/plugins/sso-flarum/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\\Middleware::GuzzleHttp\\{closure}()
            #2 /home/[redacted]/webapps/[redacted]/wp-content/plugins/sso-flarum/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\\Promise\\Promise::callHandler()
            #3 /home/[redacted]/webapps/[redacted]/wp-content/plugins/sso-flarum/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\\Promise\\Promise::G...', referer: https://WP-website.com/wp-admin/profile.php?wp_http_referer=%2Fwp-admin%2Fusers.php

            ❓️ Changing the nickname or profile picture of a normal user account does work.


            User profile image not updated in Flarum
            The user profile picture does not get updated in Flarum, but what does work is by putting the profile avatar code outside the 'if' check.
            sso-flarum.php
            line 261

            $flarum_user->attributes->avatarUrl = get_avatar_url( $user_id, array( 'size' => 100 ) );
            
            /*
            if ( get_option( 'flarum_sso_plugin_update_user_avatar' ) ) {
            	$flarum_user->attributes->avatarUrl = get_avatar_url( $user_id, array( 'size' => 100 ) );
            }
            */

            Any idea what could cause these issues?
            Let me know if you have any questions, thanks!

              maicol07

              Oh I just saw that there was an option added in the WP plugin Update user avatar. I guess I should check that?

              Edit: the 2nd problem is fixed, I forgot to enable the Update user avatar setting 😅