• Register

fetchApplication

Description

Verifies that client has a valid identifier and fetches the application data (e.g., name) for a client requesting access to user resource.

Syntax

oauth2.fetchApplication (service_key, client, uri, response_type)

Parameters

Parameter Type Description
service_key string The id of the OAuth 2.0 protected service definition
client client object A client object containing at least the client_id
uri uri object An optional uri object to validate
response_type string Optional, one of "code" or "token"

Return Value

{
 "id": <application id: integer>
 "external_id": <external application id: [null, integer]>
 "name": <application name: string>
 "attributes": <any extended attributes attached to application: [null, string]>
}

Errors (in addition to standard JSON-RPC errors)

JSON-RPC Code

Error Message

Description

-2001

An OAuth related error has occurred

An error has occurred pertaining to the OAuth operation. Please check the corresponding structure in the error object for specific details.

Sample Requests and Responses

Sample Request - Ordered Parameters

 

{
 "method": "oauth2.fetchApplication",
 "params": [
   "rmeqcgpw3zu2y47y9bs8vs2h",
   {
    "client_id":"12345"
   },
   null,
   "code"
  ],
 "id": 1
} 

Sample Request - Named Parameters

{
      "jsonrpc": "2.0", 
      "method": "oauth2.fetchApplication", 
      "params": {
            "service_key": "rmeqcgpw3zu2y47y9bs8vs2h", 
            "client": {
                  "client_id": "12345"
            }, 
            "uri": null, 
            "response_type": "code"
      }, 
      "id": 1
}

Sample Response

{
      "result": {
            "id": 12345, 
            "external_id": null, 
            "name": "OAuth 2.0 Test App", 
            "attributes": null
      }, 
      "error": null, 
      "id": 1
}

Example Error Response

{
      "result": null, 
      "error": {
            "message": "Invalid client identifier", 
            "code": -2001, 
            "data": {
                  "error": "unauthorized_client", 
                  "error_description": "Invalid client identifier", 
                  "error_response": null
            }
      }, 
      "id": 1
}

Docs Navigation