Reputation:
I have some difficulties with the twitter api on localhost.
I'm using the official Yii2 authclient extension - Yii2-AuthClient and followed this tutorial.
Everything looks fine, but when I try to call:
$twitter->api('search/tweets.json?q=%40twitterapi', 'GET');
I got the following Exception:
Request failed with code: 401, message: {"errors":[{"code":32,"message":"Could not authenticate you."}]}
My twitter app keys are as it should be.
In the app page for callback url I've tried already the following urls, but without success:
http://local-project.dev
http://localhost/project_folder/frontend/web/
http://127.0.0.1/project_folder/frontend/web/
http://127.0.0.1:80/project_folder/frontend/web/
Any ideas where I'm wrong?
Upvotes: 1
Views: 622
Reputation:
It seems that this is an issue with the yii2 extension url params parser - https://github.com/yiisoft/yii2/issues/7224.
Using the array format works like a charm:
$twitter->api('search/tweets.json', 'GET', ['q' => 'twitterapi']);
Upvotes: 1