sdk-for-php icon indicating copy to clipboard operation
sdk-for-php copied to clipboard

📚 Documentation:

Open Aronastu opened this issue 2 years ago • 3 comments
trafficstars

💭 Description

this Sdk not include, Account client side functionality. like [Create Account] [ Create Email Session] and other.

How can I do it, client side functionality in PHP SDK

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Aronastu avatar Mar 27 '23 09:03 Aronastu

Hi, Can you please elaborate a bit on this issue?

joeyouss avatar Mar 30 '23 19:03 joeyouss

I cannot find functions to create a session in Account.php. I only found functions like createRecovery, createVerification, and createPhoneVerification in Accounts. I did find it in flutter with names create, createEmailSession, etc.

How can we create sessions using PHP SDK? Am I missing something?

shreyatak avatar Apr 10 '23 04:04 shreyatak

I tried to work around the missing createEmailSession function by just calling it manually

$promise = $client->call(Client::METHOD_POST, '/account/sessions/email', [
  'content-type' => 'application/json',
], [
  'email' => $request->get('email'),
  'password' => $request->get('password'),
]);

I get a Session object in return as stated by the documentation, but when trying to get the current session with

$account->get();

I get the error

Fatal error: Uncaught Appwrite\AppwriteException: User (role: guests) missing scope (account)

and I don't know how to go from there.

I guess since the Server documentation doesn't list a createEmailSession function, that means it's not possible to authenticate a user from the server-side?

//EDIT:

Re-read the docs and found this https://appwrite.io/docs/authentication-server So we have to authenticate the user from the client-side first with JWT auth, send the JWT to the server and work from there. I personally would love a javascript-less, jwt-less, server-side solution in the future. Is that on the roadmap anywhere currently?

dweipert-3138720606 avatar Apr 13 '23 08:04 dweipert-3138720606