•  
      request #25727 Issue with refresh token
    Infos
    #25727
    Manuel Vacelet (vaceletm)
    2022-05-02 10:59
    2022-03-24 15:39
    27260
    Details
    Issue with refresh token

    After sometime of using an instance, the following issue appears:

    [d7f389e9fa02813b3c61548c] /mediawiki/gpig/ BadMethodCallException from line 35 of /opt/mediawiki/app/w/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php: Required parameter not passed: "refresh_token"
    
    Backtrace:
    
    #0 /opt/mediawiki/app/w/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php(53): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameter()
    #1 /opt/mediawiki/app/w/vendor/league/oauth2-client/src/Grant/AbstractGrant.php(76): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameters()
    #2 /opt/mediawiki/app/w/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(535): League\OAuth2\Client\Grant\AbstractGrant->prepareRequestParameters()
    #3 /opt/mediawiki/app/w/extensions/TuleapIntegration/src/TuleapConnection.php(195): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken()
    #4 /opt/mediawiki/app/w/extensions/TuleapIntegration/src/TuleapConnection.php(171): TuleapIntegration\TuleapConnection->refreshAccessToken()
    #5 /opt/mediawiki/app/w/extensions/TuleapIntegration/src/TuleapConnection.php(133): TuleapIntegration\TuleapConnection->getAccessToken()
    #6 /opt/mediawiki/app/w/skins/TuleapSkin/src/TuleapSidebar.php(26): TuleapIntegration\TuleapConnection->getIntegrationData()
    #7 /opt/mediawiki/app/w/skins/TuleapSkin/src/SkinTuleapSkin.php(56): TuleapSkin\TuleapSidebar->getStyles()
    #8 /opt/mediawiki/app/w/includes/skins/SkinTemplate.php(140): TuleapSkin\SkinTuleapSkin->initPage()
    #9 /opt/mediawiki/app/w/includes/OutputPage.php(2622): SkinTemplate->outputPage()
    #10 /opt/mediawiki/app/w/includes/MediaWiki.php(952): OutputPage->output()
    #11 /opt/mediawiki/app/w/includes/MediaWiki.php(965): MediaWiki->{closure}()
    #12 /opt/mediawiki/app/w/includes/MediaWiki.php(548): MediaWiki->main()
    #13 /opt/mediawiki/app/w/index.php(53): MediaWiki->run()
    #14 /opt/mediawiki/app/w/index.php(46): wfIndexMain()
    #15 {main}
    

    The issue is gone after cleaning the cookies

    Mediawiki Standalone
    development
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Robert Vogel (rvogel), Dejan Savuljesku (dsavuljesku)
    Stage
    Empty
    Closed
    2022-05-02
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar

    I removed refreshing of token, integration data will be retrieved once and cached as long as session is valid

    User avatar
    Thomas Gerbet (tgerbet)2022-03-30 15:28

    Hello,

    It depends how the access token is requested but for the sake of the MW<->Tuleap integration a refresh token should not be used or requested.

    Refresh tokens are dangerous beasts in the sense they allow to persist access even without any interaction from the user. The OAuth2 specification also requires a mandatory confirmation each time we initiate an exchange with the offline_access scope. This cannot work with the seamless authentication so we would have to ask for a confirmation each time the user access a MW instance.

    We should only rely on access token. If for some reasons we need to access information but the access token is already expired, we should go through another round of authentication to get a new access token.

    Does it answer the question?