Skip to content

SSO / Login with MediaWiki

Uncategorized
9 2 44
  • Hey there I want to use NodeBB as a forum to a MediaWiki install. I want to allow users to login/SSO with their existing MediaWiki account. How could I accomplish something like this? Thanks in advanced 🙂

  • Hey there I want to use NodeBB as a forum to a MediaWiki install. I want to allow users to login/SSO with their existing MediaWiki account. How could I accomplish something like this? Thanks in advanced 🙂

    ScrapBlox does MediaWiki expose their login via OAuth2?

  • I don't think the base install does but there is a popular extension OAuth to implement an OAuth server.

  • I don't think the base install does but there is a popular extension OAuth to implement an OAuth server.

    ScrapBlox in that case if you install that extension you should be able to use sso-oauth2-multiple to connect to it and log in via MediaWiki credentials.

  • Ah okay. I installed the extension and sso-oauth2-multiple and created the app. filled in the information on MediaWiki and NodeBB but I don't see anywhere to test the OAuth. How can I make it show up on the login/register area?

    EDIT: Got it to show up on the login screen but I don't know how to connect it to the MW extension.

    EDIT 2: I got the connection mostly to work now it just returns a message failed to obtain access token the nodebb config I got is
    Authorization URL
    https://{domain.tld}/rest.php/oauth2/authorize
    Token URL
    https://{domain.tld}/rest.php/oauth2/access_token
    Client ID
    {the actual id}
    Client Secret
    {the actual secret}
    User Info URL
    https://{domain.tld}/rest.php/oauth2/resource/profile
    Scope
    " "

  • Ah okay. I installed the extension and sso-oauth2-multiple and created the app. filled in the information on MediaWiki and NodeBB but I don't see anywhere to test the OAuth. How can I make it show up on the login/register area?

    EDIT: Got it to show up on the login screen but I don't know how to connect it to the MW extension.

    EDIT 2: I got the connection mostly to work now it just returns a message failed to obtain access token the nodebb config I got is
    Authorization URL
    https://{domain.tld}/rest.php/oauth2/authorize
    Token URL
    https://{domain.tld}/rest.php/oauth2/access_token
    Client ID
    {the actual id}
    Client Secret
    {the actual secret}
    User Info URL
    https://{domain.tld}/rest.php/oauth2/resource/profile
    Scope
    " "

    ScrapBlox any errors from the MediaWiki side? Not sure if there are logs you can check. Similarly, check for logs in the NodeBB side.

  • julian Kind of new to NodeBB and not entirely sure how to find the output stuff, sorry. Here's debug and oauth logs from MediaWiki though.

    debian@vps-fb921451:/var/www/mywiki$ tail -f /var/log/mediawiki/debug.log
    [rdbms] MediaWiki\MediaWikiEntryPoint::restInPeace [0.072ms] localhost: COMMIT
    [DeferredUpdates] DeferredUpdates::run: started MediaWiki\Deferred\MWCallableUpdate_require_once #506
    [rdbms] Wikimedia\Rdbms\LoadBalancer::reuseOrOpenConnectionForNewRef: reusing connection for 0/testwiki
    [rdbms] Wikimedia\Rdbms\Database::beginIfImplied (MediaWiki\Installer\Pingback::wasRecentlySent) [0.065ms] localhost: BEGIN
    [rdbms] MediaWiki\Installer\Pingback::wasRecentlySent [0.129ms] localhost: SELECT  ul_value  FROM `updatelog`    WHERE ul_key = 'Pingback-1.43.1'  LIMIT 1
    [rdbms] require_once [0.067ms] localhost: COMMIT
    [DeferredUpdates] DeferredUpdates::run: ended MediaWiki\Deferred\MWCallableUpdate_require_once #506, processing time: 0.00063896179199219
    [rdbms] LBFactory shutdown completed
    Request ended normally
    [session] Saving all sessions on shutdown
    
    debian@vps-fb921451:/var/www/mywiki$ tail -f /var/log/mediawiki/oauth.log
    2025-05-25 21:00:50 vps-fb921451 testwiki: OAuth2: Authorization request, func MediaWiki\Extension\OAuth\AuthorizationProvider\Grant\AuthorizationCodeAuthorization::init, for client edafcdddb9fb12394583b5edda9e388a and user (id) 1 using grant "authorization_code"
    2025-05-25 21:00:50 vps-fb921451 testwiki: OAuth2: Starting authorization request for client edafcdddb9fb12394583b5edda9e388a and user (id) 1
    2025-05-25 21:00:50 vps-fb921451 testwiki: MediaWiki\Extension\OAuth\Frontend\SpecialPages\SpecialMWOAuth::execute: doing 'approve' for OAuth2 with client_id 'edafcdddb9fb12394583b5edda9e388a' for 'ScrapBlox'
    2025-05-25 21:00:51 vps-fb921451 testwiki: MediaWiki\Extension\OAuth\Frontend\SpecialPages\SpecialMWOAuth::execute: doing 'approve' for OAuth2 with client_id 'edafcdddb9fb12394583b5edda9e388a' for 'ScrapBlox'
    2025-05-25 21:00:51 vps-fb921451 testwiki: MediaWiki\Extension\OAuth\Backend\ConsumerAcceptance: skipping DB update; object unchanged.
    2025-05-25 21:00:51 vps-fb921451 testwiki: ScrapBlox performed action accept on consumer edafcdddb9fb12394583b5edda9e388a
    2025-05-25 21:00:51 vps-fb921451 testwiki: OAuth2: Authorization request, func MediaWiki\Extension\OAuth\AuthorizationProvider\Grant\AuthorizationCodeAuthorization::init, for client edafcdddb9fb12394583b5edda9e388a and user (id) 1 using grant "authorization_code"
    2025-05-25 21:00:51 vps-fb921451 testwiki: OAuth2: Starting authorization request for client edafcdddb9fb12394583b5edda9e388a and user (id) 1
    2025-05-25 21:00:51 vps-fb921451 testwiki: OAuth2: Authorization request, func MediaWiki\Extension\OAuth\AuthorizationProvider\Grant\AuthorizationCodeAuthorization::authorize, for client edafcdddb9fb12394583b5edda9e388a and user (id) 1 using grant "authorization_code"
    
  • Was there any further tips to resolve the "failed to obtain access token" error? I haven't been able to figure it out thanks and apologies for the bumping of a topic.

  • Was there any further tips to resolve the "failed to obtain access token" error? I haven't been able to figure it out thanks and apologies for the bumping of a topic.

    ScrapBlox hi, sorry about the delay. Sometimes it's hard to think of what to debug next.

    Can you screen shot the settings on both sides? Feel free to blur out the client id and secret

Diese Artikel könnten Dich auch interessieren.