#How to create a session after creating a User?

28 messages · Page 1 of 1 (latest)

rose citrus
#

I am building a Flask API and using the Appwrite SDK to build a API which I'll use with my frontend.

users.create_sha_user(user_id=username, email=email, password=password, name=name, password_version='sha256')

Now, that I have got a user created, how can the user login, which I guess is creating a session?

runic turret
#

Are you referring to the option to create user session programmatically?
There is no direct way to achieve this.
You can see this message #1102768921846755432 message

rose citrus
#

Email/User ID + Password?

runic turret
rose citrus
visual basalt
rose citrus
visual basalt
rose citrus
#

I guess I can do it with the RUST API 😉

visual basalt
rose citrus
runic turret
#

In what endpoint?

#

In /v1/account/sessions/email use plain password

rose citrus
#

Ok thanks!

rose citrus
#

@visual basalt Sorry for distrubing, I managed out to create a session, but where is the cookie located?

cookie = response['cookie']```

I hope if the documentation provided example responses, I will try to check myself 😉
rose citrus
# visual basalt See <https://appwrite.io/docs/rest#client-auth>. There's also the fallback heade...

I have sent a request with Insomnia, this is the response:

{
    "$id": "64650d9c6fdec65ec0e9",
    "$createdAt": "2023-05-17T17:23:40.545+00:00",
    "userId": "someone",
    "expire": "2023-05-18 17:23:40.458",
    "provider": "email",
    "providerUid": "[email protected]",
    "providerAccessToken": "",
    "providerAccessTokenExpiry": "",
    "providerRefreshToken": "",
    "ip": "1.1.1.1",
    "osCode": "",
    "osName": "",
    "osVersion": "",
    "clientType": "",
    "clientCode": "",
    "clientName": "",
    "clientVersion": "",
    "clientEngine": "",
    "clientEngineVersion": "",
    "deviceName": "",
    "deviceBrand": "",
    "deviceModel": "",
    "countryCode": "ae",
    "countryName": "The Unknown Country :)",
    "current": true
}```
#

What should I get from here?

#

Or should I get cookies?

rose citrus
# rose citrus

I see, which one should I use? legacy ?

And how can I like use it to authenticate in front-end, like if I use NextJS?

rose citrus
#

@visual basalt

visual basalt
visual basalt