uxweb
4 years ago
1018
8
Testing

How to test social login in laravel?

Posted 4 years ago by uxweb

Hi :)

I was able to build an app that uses Laravel/Socialite to integrate Twitter authentication.

The only thing is that i want to have at least one test for the twitter auth,

Is there a way to build a test for this?

My test looks like this right now:

public function testUserCanRegisterUsingTwitter()
{
    $this->visit('/auth/login')
               ->seePageIs('/auth/login')
               ->click('Twitter')
               ->seePageIs('/');

But it fails with :

A request to [https://api.twitter.com/oauth/authenticate?oauth_token=UTOS_wAAAAAAjMu5AAABUacuqXw] failed. Received status code [404]

If i manually test that in the browser it's ok, no error.

am i missing something?

Thanks for your answers!

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