You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.
I had the same issue -- it appears to be a design problem because authentication is not abstracted from Api. So for example, when you do:
$user = new User();
$user->setCredentials(new Authentication\Basic('username', 'password'));
/* This causes $this->authenticated = TRUE and
$this->authenticator to be an instance of AuthenticationInterface
in the Api class. All is good. */
//this will work
var_dump($user->isFollowing('octocat'));
//this will not
var_dump($user->emails()->all());
Why won't the last call work? Because User::emails() instantiates a new instance of Email, which also extends from Api. So the instance variables $this->authenticator and $this->authenticated are set to their default values of null and FALSE for the instance of Api that we are now using. So when Api::doRequest() runs the authentication information is no longer there, and not passed with the request.
For a one-off project I was doing I just implemented a hack in Api::doRequest() to set the credentials there, ensuring they are present in the requests I needed to make. The real solution is to abstract the authentication stuff out of Api.
Error: "Fatal error: Call to undefined method Buzz\Browser::createRequest() in /www/project/vendor/dsyph3r/github-api3-php/lib/GitHub/API/Api.php on line 232" for OAuth Credentials type.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When I try to login the script throw no errors,
but I am obviously not logged in as
var_dump($user->emails()->all());
report unauthorized
using
$user->setCredentials(new Authentication\Basic('username', 'password'));
$user->login();
The text was updated successfully, but these errors were encountered: