yii\authclient\BaseOAuth::createApiRequest PHP Method

createApiRequest() public method

The created request will be automatically processed adding access token parameters and signature before sending. You may use [[createRequest()]] to gain full control over request composition and execution.
See also: createRequest()
Since: 2.1
public createApiRequest ( ) : Request
return yii\httpclient\Request HTTP request instance.
    public function createApiRequest()
    {
        $request = $this->createRequest();
        $request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeApiRequestSend']);
        return $request;
    }

Usage Example

Example #1
0
 /**
  * @inheritdoc
  */
 public function createApiRequest()
 {
     $request = parent::createApiRequest();
     // ensure correct event handlers order :
     $request->off(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
     $request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
     return $request;
 }