Page MenuHomePhabricator

Document updates to the OAuth extension
Closed, ResolvedPublic

Description

Update Extension:OAuth with documentation for new endpoints added for T257982

Notes

List clients

GET /oauth2/client

Example: curl -H "Accept: application/json" --cookie "<session cookie value>" <scheme/host/port/scriptpath>/rest.php/oauth2/client?oauth_version=2

Query param: oauth_version, can be 1 or 2, defaults to 2

Response example:

{
  "clients": [
    {
      "client_key": "xxx",
      "name": "TestFromCurl1807",
      "version": "1.0",
      "email": "admin@example.com",
      "callback_url": "http://default.web.mw.localhost:8080/mediawiki/",
      "scopes": [
        "authonly"
      ],
      "registration": "20200818230806",
      "stage": 0,
      "oauth_version": 2,
      "description": "foo",
      "allowed_grants": [
        "authorization_code"
      ],
      "registration_formatted": "23:08, 18 August 2020"
    }
  ],
  "total": 1
}
Reset secret

POST /oauth2/client/{client ID}/reset_secret

Example: curl -H "Accept: application/json" --cookie "<cookie>" -X POST -F reason=<reason> <scheme/host/port/scriptpath>/rest.php/oauth2/client/<client id>/reset_secret

Response example:

{
  "name": "TestFromCurl1807",
  "client_key": "xxx",
  "secret": "xxx"
}
Create client

POST /oauth2/client

Example: curl -H "Accept: application/json" --cookie "<cookie>" -X POST -F name=<name> -F description=<description> -F email=<email> -F is_confidential=<0 or 1> -F grant_types=<grant_types> -F scopes=<scopes> -F callback_url=<callback url> <scheme/host/port/scriptpath>/rest.php/oauth2/client

Response example:

{
  "name": "TestFromCurl1807",
  "client_key": "xxx",
  "secret": "xxx"
}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 28 2020, 3:19 PM
apaskulin updated the task description. (Show Details)Aug 19 2020, 9:24 PM
apaskulin updated the task description. (Show Details)Sep 1 2020, 10:26 PM
apaskulin updated the task description. (Show Details)Sep 8 2020, 11:35 PM
apaskulin added a subscriber: BPirkle.

@BPirkle This documentation is ready for your review here: https://www.mediawiki.org/wiki/Extension:OAuth#Experimental_REST_endpoints Feel free to edit the page directly and/or remove the draft banner once it looks good. Thanks!

Looks great! I changed one character (a period to a colon at the end of the first sentence, and removed the draft banner.

Feel free to revert my punctuation change if you like. I read the sentence and thought "that's great but what do I set it to?". Then I looked down and saw the next thing told me exactly that, but I had stopped and paused. A colon instead of a period would have encouraged me to keep reading rather than pausing. But if there's a good reason why my change is incorrect, please change it back and I won't complain.

apaskulin closed this task as Resolved.Sep 9 2020, 2:54 PM

Perfect! Thanks, @BPirkle!