appwrite/sdk-for-python

๐Ÿ› Bug Report: Session is not persistent

Closed this issue ยท 4 comments

๐Ÿ‘Ÿ Reproduction steps

Login the user and try to print logged in user it shows Guest user

๐Ÿ‘ Expected behavior

whenever user login it should show the logged in user

๐Ÿ‘Ž Actual Behavior

Its not storing sessions even if the user is logged in it works like no one has logged in

๐ŸŽฒ Appwrite version

Version 0.10.x

๐Ÿ’ป Operating system

Linux

๐Ÿงฑ Your Environment

No response

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

๐Ÿข Have you read the Code of Conduct?

@SmitProgrammer, thanks for raising this issue! ๐Ÿ™๐Ÿผ Can you provide more details on your steps to reproduce this such as a code snippet?

In general, you would need to use the SSR approach since the Python SDK is a server SDK.

Yeah i know that its a server side sdk but since many people need client side sdk so it would be better if we do like passing a boolean variable that denotes that user wants to create session or not then it may work with both cases.

Code to reproduce:

from appwrite.client import Client
from appwrite.services.account import Account

client = Client()

(client
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
  .set_project('5df5acd0d48c2') # Your project ID
)

auth = Account(client)

auth.create_email_password_session(email, password)

print(auth.get()) # returns Guest user

I don't think we'll go down that route as we want to keep the Python SDK as a server SDK.

Using python client-side may be challenging as there is no standard way to store the session cookie.

no what i meant is it is after running create_email_password_session the expected behavior is that we can run auth.get() and it should return the logged in user but it says "Guest User" instead of the original logged in user.

so what i meant for persistent session is once the user is logged in then it should keep it until the code is running.