New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with PhpBrowser and Guzzle6 connector #2896

Closed
Samorai opened this Issue Mar 11, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@Samorai

Samorai commented Mar 11, 2016

Hi.
I have some flow:

$I->amHttpAuthenticated($user, $password);
/** Do something  Need logout. For logout I do: */
$I->amHttpAuthenticated(null, null);
/**Need bearer Authentication*/
$I->amBearerAuthenticated($token);

But in result I am not bearer authenticated, I am Http authenticated with null:null credentials.

Connector Guzzle6 has not method to access protected variable $requestOptions;

I purpose change body of method setAuth to

if (is_null($username) && is_null($password)) {
    unset($this->requestOptions['auth']);
} else {
    $this->requestOptions['auth'] = [$username, $password];
}

https://github.com/Codeception/Codeception/blob/2.1.6/src/Codeception/Lib/Connector/Guzzle6.php#L81

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Mar 11, 2016

Member

Thanks. I think this can be simplified like:


if (!$username) {
    unset($this->requestOptions['auth']);
    return;
}
$this->requestOptions['auth'] = [$username, $password];

I will include it into GuzzleConnector

Member

DavertMik commented Mar 11, 2016

Thanks. I think this can be simplified like:


if (!$username) {
    unset($this->requestOptions['auth']);
    return;
}
$this->requestOptions['auth'] = [$username, $password];

I will include it into GuzzleConnector

@DavertMik DavertMik closed this in e24ba1e Mar 11, 2016

Naktibalda added a commit to Naktibalda/Codeception that referenced this issue Mar 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment