yiisoft / yii2-authclient

Yii 2 authclient extension.
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
464 stars 246 forks source link

Twitter "App-only authentication" #178

Closed cbepxpa3ym closed 7 years ago

cbepxpa3ym commented 7 years ago

https://api.twitter.com/oauth2/token

This feature is not available. Should be the authenticateClient method added to client?

klimov-paul commented 7 years ago

I suppose issue refers to this feature: https://dev.twitter.com/oauth/application-only

cbepxpa3ym commented 7 years ago

Yes, that would be great.

klimov-paul commented 7 years ago

There is no way I can integrate a single OAuth 2 feature into OAuth 1 client. The only thing I can do is creation of TwitterOAuth2 seprated client, which can be used for this feature. But since Twitter does not provide full support for OAuth 2 such client will be unable to function with user-behalf workflow.

cbepxpa3ym commented 7 years ago

Then it would be great to get a separate client, related to the app only functionality. We already have a choice how to use facebook client - use it with user or app workflow. With the Twitter situation we may use a separate classes Twitter or TwitterApp (some combination of OAuth1 and OAuth2 functionality).

cbepxpa3ym commented 7 years ago

Currently I made a temporary helper (just a fast workaround). TwitterApi.php.txt

klimov-paul commented 7 years ago

Resolved by commit f710531cc241e9176dcaffb8c1d4b37f81f37bd9

cbepxpa3ym commented 7 years ago

This does not work. Look at my code to understand why (at the Bearer header).

cbepxpa3ym commented 7 years ago

So, with your code it do this:

GET https://api.twitter.com/1.1/statuses/show.json?id=[id]&access_token=[token]

But should be:

GET https://api.twitter.com/1.1/statuses/show.json?id=[id] Authorization: Bearer [token]

klimov-paul commented 7 years ago

ef7b66a648006b19071b519191f8375a35c929c9