Page MenuHomePhabricator

OAuth issue when trying to authorize
Closed, ResolvedPublicBUG REPORT

Description

I'm not sure if this is me being an idiot (probably, likely), but whenever I try to authorize OAuth at rest.php/oauth2/authorize, I'm thrown an error:

{
   "message": "Error: exception of type Error",
   "httpCode":500,
   "httpReason":"Internal Server Error"
}

I'm not entirely sure what is causing this, and I can't get MediaWiki to post anything to my error log about what could be causing this. Not entirely sure if this is iscolated to me (if I'm doing something that is causing this), or if it's a genuine error. I'm running Php 8.1 and MediaWiki 1.39.1, any help debugging this would be appreciated!

OAuth configuration:

'wgMWOAuthCentralWiki' => [
        'default' => 'metawiki',
    ],
    'wgOAuth2GrantExpirationInterval' => [
        'default' => 'PT4H',
    ],
    'wgMWOAuthSharedUserSource' => [
        'default' => 'CentralAuth',
    ],
    'wgMWOAuthSecureTokenTransfer' => [
        'default' => true,
    ],
    'wgOAuth2PublicKey' => [
        'default' => '/etc/private/public.key',
    ],
    'wgOAuth2PrivateKey' => [
        'default' => '/etc/private/private.key',
    ],

Event Timeline

In the first approximation, this sounds like a bug in the REST API error logging code. A HTTP 500 should always be logged.

In the first approximation, this sounds like a bug in the REST API error logging code. A HTTP 500 should always be logged.

Ah, took a bit, looks like the error was being supressed.

The trace appears to be:

[exception] [7daf09a23a12ca6b85155525] /rest.php/oauth2/authorize   Error: Class "League\OAuth2\Server\Exception\OAuthServerException" not found

I'm up to date with the REL1_39 branch, running commit a30633b. I've tried composer install --no-dev, which didn't change anything.

Full trace:

[exception] [0dd0d6e4de69b348440d6887] /rest.php/oauth2/authorize   Error: Class "League\OAuth2\Server\Exception\OAuthServerException" not found
#0 /var/www/html/mediawiki/includes/Rest/Router.php(478): MediaWiki\Extension\OAuth\Rest\Handler\AuthenticationHandler->validate()
#1 /var/www/html/mediawiki/includes/Rest/Router.php(406): MediaWiki\Rest\Router->executeHandler()
#2 /var/www/html/mediawiki/includes/Rest/EntryPoint.php(170): MediaWiki\Rest\Router->execute()
#3 /var/www/html/mediawiki/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#4 /var/www/html/mediawiki/rest.php(31): MediaWiki\Rest\EntryPoint::main()

Can you verify that your vendor/leage/oauth2-server directory has some files? Does vendor/league/oauth2-server/src/Exception/OAuthServerException.php exist? What's the version of the library you are using (you can check in composer.lock)?

OriginalAuthority claimed this task.

Can you verify that your vendor/leage/oauth2-server directory has some files? Does vendor/league/oauth2-server/src/Exception/OAuthServerException.php exist? What's the version of the library you are using (you can check in composer.lock)?

Ah, seems those files didn't exist. Running composer install (outside of the extension folder) worked as opposed to inside of it. Thank you for the insight!

This comment was removed by OriginalAuthority.