
Currently I am login and control what can user see with SSR but I would like to upload files directly to appwrite without upload files first to my server due avoid innecesary traffic. I tried using "{ 'X-Fallback-Cookies': 'my-cookie-name-for-session-token' }" for the headers but I can not receive anything different than 401. Do I have to decide if I want between SSR and SCR? I mean, should I decide if I want my server as middle point between the frontend and backend (appwrite) or use directly the backend?
Is there a way to specify which cookie name should Appwrite use?
I have configured custom domain name but I am testing on localhost.

Set the token from your cookie as the session on your client
const token = cookies.get('cookie');
const client = new Client().setEndpoint().setProject().setSession(token);

You mean inject it into the client side code, right? I though about it but not sure about safety π

But it seems as the only one solution if bandwidth is the top priority π

You'll need a new appwrite client avaliable on the client side if you want to directly upload from the client.

Thank you @Kenny just want to confirm that in case I was missing something in the doc... I was looking like mad person π

im on same boat, according to what i read from here, im doing this:
Php:
// Initialize admin client here
// ...
// Get email and password from request
$email = $_POST['email'];
$password = $_POST['password'];
try {
$account = new Account($adminClient);
// Create the session using the Appwrite client
$session = $account->createEmailPasswordSession($email, $password);
// Set the session cookie
setcookie('session', $session['secret'], [
'httpOnly' => true,
'secure' => true,
'sameSite' => 'strict',
'expires' => strtotime($session['expire']),
'path' => '/',
]);
echo json_encode(['success' => true]);
} catch (Exception $e) {
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}```
JS (web) part:
```const token = Cookies.get('session');
console.log('Token: ',token);
const client = new Appwrite.Client().setEndpoint(endpoint).setProject('abc').setSession(token);
console.log('Client: ', client);```
Console shows this:
`Token: undefined`
```Client:
config: Object { endpoint: "https://abc.com", endpointRealtime: "wss://abc.com", project: "abc", β¦ }
endpoint: "https://abc.com"
endpointRealtime: "wss://abc.com"
jwt: ""
locale: ""
project: "abc"
ββsession: undefined```
According to what i see, its because the cookie is marked as HttpOnly, and it can only be accessed by the server, not via JavaScript.
So.. do i need to disable the httponly? or is there a better approach to this?
Recommended threads
- Unable to create push providers - FCM or...
Currently unable to create a push provider for FCM or APNS.... https://github.com/appwrite/console/issues/2045 When uploading a file... FCM = Valid file retu...
- Stuck in "deleting"
my parent element have relationship that doesnt exist and its stuck in "deleting", i cant delete it gives me error: Collection with the requested ID could not b...
- Help with 409 Error on Relationship Setu...
I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up: Collection A has 3 attributes and a two-way 1-to-m...
