The Appwrite PHP SDK is helping me update a user's password, but I am having trouble with it. The code I am using is this one:
<?php
require 'vendor/autoload.php';
use Appwrite\Client;
use Appwrite\Services\Users;
use Appwrite\Services\ServiceException;
$user_name = $_POST['username'];
$password = $_POST['password'];
$getUserByid = getUserByid($user_id);
$appwrite_id = $getUserByid['appwrite_id'];
$client = new Client();
$client
->setEndpoint('Your API Endpoint')
->setProject('Your project ID')
->setKey('Your secret API key');
$users = new Users($client);
try {
$response = $users->updatePassword($appwrite_id, $password);
var_dump($response);
} catch (ServiceException $e) {
echo 'Error updating user password: ' . $e->getMessage();
}
?>
However, when I check the user's information in the Appwrite console, the password field remains empty.
I have also tried creating user with their encrypted password code:
$result = $users->createMD5User('[USER_ID]', '[email protected]', 'password');
The Appwrite console's password field is left empty in both scenarios. Could you please check if there is a problem with the Appwrite PHP SDK or what I might be doing incorrectly?
I have read through their documentation (https://appwrite.io/docs/server/users?sdk=php) regarding related code. ), and tried all of their updated password codes and encrypted password user codes, but every time I tried, the same thing happened!
I realized my error; my code was actually operating correctly, but user passwords are hashed and not visible in the console for security and privacy reasons.