• Register

fetchAccessToken

Description

Fetches the specified access token and data associated with the token or returns that it is invalid.

Syntax

oauth2.fetchAccessToken (service_key, access_token)

Parameters

Parameter Type Description
service_key string The id of the OAuth 2.0 protected service definition
access_token string
Access token value. Accepts a string or a list of values. When a list is passed (even if a single token in the list), a list of tokens is returned where the token object also includes a member called "access_token" so the caller knows towhich token the data belongs.

Return Value

{
   "result":{
      "client_id":"<client_id>",
      "token_type":"<token_type>",
      "grant_type":"<grant_type>",
      "expires":"<expiration_date>",
      "scope":"<scope>",
      "user_context":"<user_context>",
      "extended":null
   },
   "error":null,
   "id":0
}

Errors

Standard JSON-RPC errors.

Sample Requests and Responses

Sample Request - Ordered Parameters

{
   "jsonrpc":"2.0",
   "method":"oauth2.fetchAccessToken",
   "params":[
      "rmeqcgpw3zu2y47y9bs8vs2h",
      "csqvjdxmduxbg78au9q2xqmy"
   ],
   "id":1
}

Sample Request - Named Parameters

{
   "jsonrpc":"2.0",
   "method":"oauth2.fetchAccessToken",
   "params":{
      "service_key":"rmeqcgpw3zu2y47y9bs8vs2h",
      "access_token":"csqvjdxmduxbg78au9q2xqmy"
   },
   "id":1
}

Sample Response - Token Found

{
   "jsonrpc":"2.0",
   "result":{
      "client_id":"8gmr4zwzje4yxk37t97ncrjc",
      "token_type":"bearer",
      "grant_type":"password",
      "expires":"2012-01-19T02:20:38Z",
      "scope":"http:\/\/www.example.com",
      "user_context":"user12345",
      "extended":null
   },
   "id":1
}

Sample Response - Token Not Found

{
   "jsonrpc":"2.0",
   "error":{
      "message":"Invalid Access Token",
      "code":-2001,
      "error":{
         "error":404,
         "error_description":"Invalid Access Token",
         "error_response":null
      }
   },
   "id":1
}
rmeqcgpw3zu2y47y9bs8vs2h

Docs Navigation