yii2-api

angular2 service request header response for X-Pagination-Page-Count

喜欢而已 提交于 2019-12-11 17:56:46
问题 I am using angular2 service to get data response from yii2 api. In browser network tab it showing all required response but when I am trying to get it directly from component like response.headers.get('X-Pagination-Page-Count') Then it's not showing anything. except only showing content-type in response header via code. but can't get a function response. below is my service function. getResponse(endpointUrl: string): Observable<any> { const url = url; return this._http.get(url) .catch((err) =

Using CORS filter to block Ajax Requests

梦想的初衷 提交于 2019-12-11 06:36:01
问题 I am trying to understand how CORS Filter works and how can one benefit from it especially when we are talking about the Origin option. I am working on a project where i need to provide access for the client to add lead into the API using Ajax requests. I am using yii\rest\Controller for my controller. I have an API already in place and working, I have a base controller where I set my behavior and other common methods and extend all my controllers from this base controller. The code for the

Yii2 Rest Api User bearer Authentication expiration time

倾然丶 夕夏残阳落幕 提交于 2019-12-11 02:18:44
问题 i am currently working on a yii2 based Rest api. i use bearer token for user authentication.let me explain the requirement. 1)first user authenticated from a external php application using their credentials. 2)he/she got an access Token. 3)each subsequent request is made using this access token. public static function findIdentityByAccessToken($token, $type = null) { return static::findOne(['auth_key' => $token]); } this is where i start thinking. i do not found any expiration time for the

Twitter API : Not Getting User Email - Yii2

此生再无相见时 提交于 2019-12-02 05:46:24
I'm getting error like Unknown Property – yii\base\UnknownPropertyException Setting unknown property : yii\authclient\clients\Twitter::requestEmail Whenever I am including 'requestEmail' => 'true', in 'authClientCollection' => [ for components in web.php web.php $config = [ . . 'components' => [ . . 'authClientCollection' => [ 'class' => 'yii\authclient\Collection', 'clients' => [ 'twitter' => [ 'class' => 'yii\authclient\clients\Twitter', 'requestEmail' => 'true', 'consumerKey' => 'IFK2OMG0rKIFK2Jt4rLvw', 'consumerSecret' => 'ImTprQzaOMG0rKZsZiPDIvwIFK2aOMG0rKZsZiPD', ], ], ], ],