MyBB Community Forums

Full Version: MyBBAuth: a MediaWiki extension enabling wiki login via credentials on a MyBB forum
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
MyBBAuth is an extension for recent versions of MediaWiki (>= 1.27.0; latest version tested: 1.35.1) which allows members of a MyBB forum to log in to MediaWiki with their MyBB credentials, and which blocks direct MediaWiki logins and account registrations.

The MyBB forum must be hosted on the same server as the MediaWiki instance, or at least its filesystem and database server must be directly accessible to/by MyBBAuth.

For now, only MyBB forums running on MySQL/MariaDB databases are supported.

Installation and configuration

Upload the root directory of this plugin as the MyBBAuth directory in your MediaWiki's extensions directory. Then, in your MediaWiki's LocalSettings.php file, add these two lines:

wfLoadExtension('MyBBAuth');
$wgMyBBAuthForumPath = '/home/yourusername/public_html/mybb/';

where you should customise the value of $wgMyBBAuthForumPath to the fully qualified path to your MyBB forum's root directory on the shared filesystem. This allows the plugin to access your MyBB configuration file, and thereby connect to its database.

Credits

MyBBAuth draws major inspiration from, and in a sense is an update for newer versions of MediaWiki to, MyBB-Mediawiki-Bridge.
Great! Thx!

Unfortunately, I had to choose a different way because there were not any working plugin for that in past... in my next project I will definitely use this bridge between MyBB and MediaWiki Smile
Thank you for your contribution once again Smile
Does this share session cookies or just login credentials?
Just login credentials. I might try to get shared session cookies happening for a later release, but I can't promise to do that. I'd happily accept a PR in the meantime.
Hi,

I'm attempting to setup this plugin on a brand new install of myBB and MediaWiki in a test environment before I setup MediaWiki on a server with a pre-existing MyBB setup.

I installed myBB version 1.8.22 (I know it's not the latest but that is what is on the production server at the moment) and MediaWiki 1.35.2 on an Ubuntu 20.10 server. (PHP version is 7.4.18)

myBB is installed under the /var/www/mybb/ folder and is working (accessible via https://server.domain.com/)
MediaWiki is installed under the /var/lib/wiki/ folder, and there is a symbolic link under /var/www/mybb/wiki/ so i can access the site via https://server.domain.com/wiki

By default, both installs work.

I downloaded your files using wget and placed it in the following folders
/var/lib/wiki/extensions/MyBBAuth/LICENSE
/var/lib/wiki/extensions/MyBBAuth/README.md
/var/lib/wiki/extensions/MyBBAuth/extension.json
/var/lib/wiki/extensions/MyBBAuth/auth/MyBBAuthenticationProvider.php
/var/lib/wiki/extensions/MyBBAuth/auth/MyBBAuthenticationRequest.php
/var/lib/wiki/extensions/MyBBAuth/i18n/en.json

I then modified my LocalSettings.php and added the following two lines at the end of the file

#wfLoadExtension('MyBBAuth');
$wgMyBBAuthForumPath = '/var/www/mybb/';

I then refreshed the Mediawiki page and all it returns is a blank page. I thought this was a permissions issue accessing the /var/www/mybb/ folder at first, but I discovered this in the Apache error log when I did some further digging.

[Sun May 23 03:35:37.627736 2021] [php7:error] [pid 50290] [client <IP REMOVED>:51785] PHP Fatal error: Uncaught Exception: /var/lib/wiki/extensions/MyBBAuth/extension.json is not a valid JSON file. in /var/lib/wiki/includes/registration/ExtensionRegistry.php:349\nStack trace:\n#0 /var/lib/wiki/includes/registration/ExtensionRegistry.php(231): ExtensionRegistry->readFromQueue()\n#1 /var/lib/wiki/includes/Setup.php(161): ExtensionRegistry->loadFromQueue()\n#2 /var/lib/wiki/includes/WebStart.php(89): require_once('/var/lib/wiki/i...')\n#3 /var/lib/wiki/index.php(44): require('/var/lib/wiki/i...')\n#4 {main}\n thrown in /var/lib/wiki/includes/registration/ExtensionRegistry.php on line 349

Did I do something stupid or is there something else on the go here?
Hmm. That's puzzling. For debugging purposes, please:
  1. Share the contents of /var/lib/wiki/extensions/MyBBAuth/extension.json.
  2. Run the attached script and share its output.
(You might then want to uncomment in that script the second assignment to $path and again share its output).
(2021-05-23, 05:07 AM)Laird Wrote: [ -> ]Hmm. That's puzzling. For debugging purposes, please:
  1. Share the contents of /var/lib/wiki/extensions/MyBBAuth/extension.json.
  2. Run the attached script and share its output.
(You might then want to uncomment in that script the second assignment to $path and again share its output).

Here you go.

I did have a peek at the top of the extension.json and noticed a few spaces. I did try and remove them but it made no difference.

edit: I'm a dumbass. I compared it to the one I downloaded it on my Windows PC. Guess wget grabbed a GitHub webpage instead of the JSON webpage.
OK. I see the problem. You need to download the raw version of the GitHub files. There's a "Raw" button to click that will load a file raw. Easier than downloading raw files one-by-one though is on the extension's main GitHub page to click the "Code" button and then click "Download zip". Then you can extract the files from the zip and upload them all in one go to /var/lib/wiki/extensions/MyBBAuth.
Thanks,

I feel like an idiot for not comparing them last night (Guess I was tired as it was fairly late last night when I was trying to figure this out). I have it working now.

I did have to add $wgGroupPermissions['*']['autocreateaccount'] = true; also to my LocalSettings.php and restart Apache as it said that Automatic Account Creation was not allowed. Once I added that to the end, I was able to login to MediaWiki using the same login as myBB.
Pages: 1 2