Closed mikehaertl closed 11 years ago
We should provide a method to inject authentication methods.
I'd suggest to expose a event onBeforeRequest, that receives the Guzzle request object in $event->request. This way we can easily integrate OAuth2Yii:
onBeforeRequest
$event->request
'components' => array( 'restyii' => array( 'onBeforeRequest' => function($event) { if($token = Yii::app()->oauth2->getProvider('abc')->accessToken)!==null) { $event->request->addHeader('Authorization: Bearer '.$token); } },
We should provide a method to inject authentication methods.
I'd suggest to expose a event
onBeforeRequest
, that receives the Guzzle request object in$event->request
. This way we can easily integrate OAuth2Yii: