Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SyntaxError: Unexpected token y in JSON at position 0 at Json.parse
- y2sSCEXqkUoVY2BjkQZqx8g3W42273Cz{"success":false,"message":"you liked it before"}
- public function behaviors()
- {
- $behaviors = parent::behaviors();
- $behaviors['contentNegotiator'] = [
- 'class' => ContentNegotiator::className(),
- 'formats' => [
- 'application/json' => Response::FORMAT_JSON,
- ],
- ];
- // remove authentication filter
- $auth = $behaviors['authenticator'];
- unset($behaviors['authenticator']);
- // add CORS filter
- $behaviors['corsFilter'] = [
- 'class' => CorsCustom::className(),
- ];
- // re-add authentication filter
- $behaviors['authenticator'] = $auth;
- // avoid authentication on CORS-pre-flight requests (HTTP OPTIONS method)
- $behaviors['authenticator']['except'] = ['options'];
- $behaviors['authenticator'] = [
- 'class' => CompositeAuth::className(),
- 'only' => ['like', 'unlike', 'likes', 'create'],
- 'authMethods' => [
- HttpBearerAuth::className(),
- ],
- ];
- return $behaviors;
- }
Add Comment
Please, Sign In to add comment