AdamWathan\EloquentOAuth\Authenticator::login PHP Method

login() public method

public login ( $providerAlias, $userDetails, $callback = null, $remember = false )
    public function login($providerAlias, $userDetails, $callback = null, $remember = false)
    {
        $user = $this->getUser($providerAlias, $userDetails);
        $user = $this->runCallback($callback, $user, $userDetails);
        $this->updateUser($user, $providerAlias, $userDetails);
        $this->auth->login($user, $remember);
    }

Usage Example

 public function test_login_uses_existing_user_if_matching_user_exists()
 {
     $auth = M::mock('Illuminate\\Auth\\AuthManager');
     $users = M::mock('AdamWathan\\EloquentOAuth\\UserStore')->shouldIgnoreMissing();
     $identities = M::mock('AdamWathan\\EloquentOAuth\\IdentityStore')->shouldIgnoreMissing();
     $userDetails = M::mock('AdamWathan\\EloquentOAuth\\ProviderUserDetails');
     $identity = new OAuthIdentity();
     $user = M::mock('stdClass')->shouldIgnoreMissing();
     $authenticator = new Authenticator($auth, $users, $identities);
     $identities->shouldReceive('userExists')->andReturn(true);
     $identities->shouldReceive('getByProvider')->andReturn($identity);
     $users->shouldReceive('create')->never();
     $users->shouldReceive('findByIdentity')->andReturn($user);
     $auth->shouldReceive('login')->with($user)->once();
     $authenticator->login('provider', $userDetails);
 }
All Usage Examples Of AdamWathan\EloquentOAuth\Authenticator::login