Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-60161

'Accept: application/json' is being set multiple times in the Oauth library

XMLWordPrintable

    • MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • wip-MDL-60161-master-test
    • Easy
    • Hide

      While I cannot find an API service that generates an error, except the one we integrate with Mulesoft, here is an example where you could get multiple accept: application/json in the header because the foreach loop and $this->boxclient->upload_file, which would eventually calls oauth2_client::request, is being called multiple times.

      This issue is now covered by a unit test

      Show
      While I cannot find an API service that generates an error, except the one we integrate with Mulesoft, here is an example where you could get multiple accept: application/json in the header because the foreach loop and $this->boxclient->upload_file , which would eventually calls oauth2_client::request , is being called multiple times. This issue is now covered by a unit test

      This is related to a fix committed to MDL-59473.  In lib/oauthlib.php, line 618, we should check to see if the header is already set before calling $this->setHeader('Accept: application/json').  The API calls were failing on some OAuth systems because of multiple "Accept: application/json" showing up in the header.

      I have checked the following API services that Moodle core uses, but none of them have any issue handling duplicate 'Accept: application/json' in the header.  The API service we use with our SIS system is handled by Mulesoft.  They are giving us this exception, org.mule.api.MessagingException: null (java.lang.ClassCastException). If someone else out there uses Mulesoft, it would be great if you can test this too.

      The API services I have checked:

      • Box.com
      • Google drive
      • Dropbox
      • Microsoft OneDrive

       

            carsontam Carson Tam
            carsontam Carson Tam
            Adrian Greeve Adrian Greeve
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            CiBoT CiBoT
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.