APEX
APEX
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Yeah ok that works, it's not really much better than the other solution but at least it consolidates all my API calls to only using tRPC.
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
That feels very hacky
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Maybe I can supply a custom fetch() that detects set-cookie in the response?
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Yes, I'm using this already. I mention it here
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
I am aware that this is probably an uncommon and unsupported use case (specifically the part about this being a 3rd party client), but I still think it highlights either a feature missing from the vanilla client, or, if the feature does exist, it highlights missing documentation for it
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
There is a server running NodeJS+tRPC. I am trying to write a different NodeJS package, also using tRPC, for making programmatic API calls to that server. The API server does session tracking using Set-Cookie. The API client, since it is also NodeJS, does not respect the Set-Cookie header (as far as I am aware), so I have to access the header myself to store the cookie in a variable somewhere. My issue is that I cannot figure out how to directly access the request header using @trpc/client.
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Maybe it would be helpful to know that I cannot modify the server? It is running on a website I don't manage. I'm writing a third party API client, I am forced to deal with the Set-Cookie header.
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
I think there has to be a miscommunication somewhere lol
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
The solution I'm using as of yesterday is to use fetch to call the login API and save the cookie to a variable, then use the headers function of the object I pass to httpBatchLink to set that cookie in subsequent requests' headers (using tRPC for subsequent requests).
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Ok, I think my issue here then is documentation. I understand that you can write middleware for the server by calling .use on a procedure, but I don't see anything about doing this on the client.
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Okay, how do I actually get the header? Can I write middleware for the client?
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Again, there is no browser involved here. I am running the vanilla client in NodeJS.
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
Node AFAIK does not store the cookie, subsequent requests are met with auth errors
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
This is NodeJS, not the browser
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
I think my issue is actually not quite related to OP's issue but you'll forgive me since I have been staring at my screen too long
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
No description
27 replies
TtRPC
Created by Tuxer on 5/14/2023 in #❓-help
How to pass context to vanilla client?
I want to revive this because I searched through #❓-help and didn't find any other post answering this. If your server sets Set-Cookie, how do you retrieve that cookie in the Vanilla tRPC client?
27 replies