Rank 1: Thread
What i am doing wrong?
Votes
0
Replies
17
Participants
Unknown
Messages
18
Rank 1: Thread
What i am doing wrong?
Can you try to add the any role to the collection?
Rank 1: Thread
It works with Any
Rank 1: Thread
Is the problem related with client-side session ?
So you might not have a session then. Did you log in first?
Rank 1: Thread
I got session on server not client
Rank 1: Thread
Createdocument requires client session?
How?
You set the collection permissions to users. That means only logged in users (session)
Rank 1: Thread
Third photo i use next-auth with appwrite rest apis
I see so this createDocument()...is that being executed server side with the session cookie?
Rank 1: Thread
No Createdocument is now in nextjs client component
So if there's no session, that would explain the error.
Rank 1: Thread
Ok I understand now
Btw, since you're creating the session server-side, if you have Appwrite running on a subdomain of your app and you have your app set a cookie, the same cookie should be used for both Appwrite and your app
Rank 1: Thread
So the Createdocument function work if only appwrite has the session on browser not only in user dashboard
See this repo for setting the session on the server and client side: https://github.com/Meldiron/appwrite-ssr-next-js
Rank 1: Thread
Ok , thanks for explaining