Is it possible to use force_login for Twitter in Laravel Socialite?

Published 1 year ago by RoboRobok

In my app, I'm using "Log in with Twitter" feature. I want to ask users for password each time they log in, for better security. Facebook allows to enable it on their side, Twitter seems to handle it by API parameter only. This parameter is called force_login, as described in the documentation.

Can I make Laravel Socialite use this parameter?

RoboRobok

Up.

RoboRobok

Up.

d3xt3r
d3xt3r
1 year ago (135,430 XP)

From the docs ...

A number of OAuth providers support optional parameters in the redirect request. To include any optional parameters in the request, call the with method with an associative array:

return Socialite::driver('google')
            ->with(['hd' => 'example.com'])->redirect();
RoboRobok

After research, I see that it can't be done for Twitter, because Twitter Provider extends OAuth One provider, which doesn't have with() method. It exists for Google and Facebook though. I think Twitter's authentication with force_login parameter is not a true OAuth operation and that's why it's not handled by Socialite. Too bad.

Please sign in or create an account to participate in this conversation.