Guest User

Untitled

a guest
Mar 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. SyntaxError: Unexpected token y in JSON at position 0 at Json.parse
  2.  
  3. y2sSCEXqkUoVY2BjkQZqx8g3W42273Cz{"success":false,"message":"you liked it before"}
  4.  
  5. public function behaviors()
  6. {
  7. $behaviors = parent::behaviors();
  8. $behaviors['contentNegotiator'] = [
  9. 'class' => ContentNegotiator::className(),
  10. 'formats' => [
  11. 'application/json' => Response::FORMAT_JSON,
  12. ],
  13. ];
  14. // remove authentication filter
  15. $auth = $behaviors['authenticator'];
  16. unset($behaviors['authenticator']);
  17. // add CORS filter
  18. $behaviors['corsFilter'] = [
  19. 'class' => CorsCustom::className(),
  20. ];
  21. // re-add authentication filter
  22. $behaviors['authenticator'] = $auth;
  23. // avoid authentication on CORS-pre-flight requests (HTTP OPTIONS method)
  24. $behaviors['authenticator']['except'] = ['options'];
  25. $behaviors['authenticator'] = [
  26. 'class' => CompositeAuth::className(),
  27. 'only' => ['like', 'unlike', 'likes', 'create'],
  28. 'authMethods' => [
  29. HttpBearerAuth::className(),
  30. ],
  31. ];
  32.  
  33. return $behaviors;
  34. }
Add Comment
Please, Sign In to add comment