atymic / twitter

Twitter API for Laravel 5.5+, 6.x, 7.x & 8.x
https://atymic.dev
MIT License
922 stars 290 forks source link

How we can use for multiple users with only one app? #382

Closed akhzir closed 1 year ago

akhzir commented 2 years ago

How we can use for multiple users with only one app?

I have a Larvel application, where i want to auto post for admin as well as other multiple users.

i want to use only 1 application. How this is possible.

natsumeaurlia commented 2 years ago

@akhzir hi. I had the same problem. I think I can solve it by using usingCredentials.

Use the method described in the readme or Socialite to save the access token and access token secret of the integrated account in the DB. Then, just pass the access token and access token secret to usingCredentials.

スクリーンショット 2022-02-12 22 37 00

$account = Account::first();
$twitter = \Atymic\Twitter\Facade\Twitter::usingCredentials($account->access_token, $account->access_token_secret);
dd($twitter->getSearch(['q' => 'twitter']));

Alternatively, the Twitter account can register with Twitter Developer to get Access Token, Consumer Key...

I hope this helps.