示例#1
0
 /**
  * Retrieve an access token for the given grant_type and payload.
  *
  * @param string $grant_type the grant type to use
  * @param array $data extra data to send to the oauth server
  *
  * @return string a valid access token
  */
 public static function getToken($grant_type, $data)
 {
     $payload = array_merge(['grant_type' => $grant_type, 'client_id' => Api::$client_id, 'client_secret' => Api::$client_secret], $data);
     if ($grant_type == 'authorization_code') {
         $payload['redirect_uri'] = Api::$redirect_url;
     }
     return Requester::post('oauth/token', $payload);
 }
示例#2
0
 public static function create($data)
 {
     return Requester::post(self::collectionUrl(), $data);
 }