Open nuboxas opened 5 years ago
I get the same.
Error: Call to undefined method MrShan0\PHPFirestore\Authentication\FirestoreAuthentication::setLastResponse() in /var/www/vendor/ahsankhatri/firestore-php/src/Authentication/FirestoreAuthentication.php on line 155
Looks like that should be
$this->client->setLastResponse($exception->getResponse());
But the bigger issue is, why are the credentials being used, not letting us authenticate therefore landing us in the catch area.
Here's my patch
Index: vendor/ahsankhatri/firestore-php/src/Authentication/FirestoreAuthentication.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/ahsankhatri/firestore-php/src/Authentication/FirestoreAuthentication.php (date 1567007717000)
+++ vendor/ahsankhatri/firestore-php/src/Authentication/FirestoreAuthentication.php (date 1567007717000)
@@ -15,7 +15,7 @@
*
* @var string
*/
- private $authRoot = 'https://www.googleapis.com/identitytoolkit/v3/relyingparty/';
+ private $authRoot = 'https://identitytoolkit.googleapis.com/v1/accounts:';
/**
* Firestore Client object
@@ -82,7 +82,7 @@
*/
public function signInEmailPassword($email, $password, $setToken = true)
{
- $response = $this->authRequest('POST', 'verifyPassword', [
+ $response = $this->authRequest('POST', 'accounts:signInWithPassword', [
'form_params' => [
'email' => $email,
'password' => $password,
@@ -146,13 +146,19 @@
unset($options['headers']['Authorization']);
}
$this->client->setLastResponse(
$this->client->getHttpClient()->request($method, $this->constructUrl($resource), $options)
);
return FirestoreHelper::decode((string) $this->client->getLastResponse()->getBody());
} catch (BadResponseException $exception) {
- $this->setLastResponse($exception->getResponse());
+ if (!empty($this->client) && method_exists($this->client, 'setLastResponse')) {
+ $this->client->setLastResponse($exception->getResponse());
+ }
$this->handleError($exception);
}
}
Hi,
When I am trying to auth:
I am getting
Call to undefined method MrShan0\PHPFirestore\Authentication\FirestoreAuthentication::setLastResponse() at ahsankhatri\\firestore-php\\src\\Authentication\\FirestoreAuthentication.php:155
Any ideas?
Thanks