How to get external key other than INPUT from RESTFUL request?

SSO callback my api like api/trpc/user.login?token=abc
N
Nick402d ago
Could you describe your problem in more depth?
B
backbone402d ago
My company has a project (named center login system) just for user login and logout. I have to combine that to my project. When my project's user login, it redirects to the login system page. Its backend would callback my tRPC func using get request (like the url api/trpc/user.login?token=abc ) , in purpose to tell me who is login. But tRPC url request like api/trpc/user.login?input=JSON.stringify(object). In tRPC, I can't get query params but input
N
Nick402d ago
Right, I think tRPC is a bad choice for this You’d be better off using express for the auth stuff and mount tRPC within express using the adapter for the business API
B
backbone401d ago
Thank for your answer. I have solved this question. I use tRPC context and inject req and res from expressjs. Link this question tRPC doesn't support redirect. https://discord.com/channels/867764511159091230/1084901636146729020 The login system backend callback my url , I have to redirect to my front page in this url. If I just use expressjs to redirect. This is redundant.I have to develop in both expressjs and tRPC. One for redirect, one for my project code.
N
Nick401d ago
It’s completely normal to separate your auth api and business api, but even more expected when you’re essentially implementing OpenId but want to use a non-http standard for the business api. OpenId is http oriented I’d just pick an OpenId provider like Auth0
More Posts
Cannot read properties of undefined (reading 'createTRPCReact')I'm trying to use it in an Astro project. https://github.com/Industrial/test-astro-solid/blob/main/application/octet-stream responseIm refactoring my old backend to trpc so far it was a pleasure and fairly straight forward process ❤Discriminated union handleHow Do I handle Input type if its discriminated union?? ``` export const batchTasksRouter = createHit external APIs ...I'm new to tRPC, I need to hit an external API (OpenAI) directly from the client-side. Can I still uCannot get subscription event to fireRipping my hair out here trying to get Websockets working with tRPC and Next. Everything seems to bHow to organise reusable functionsHow do you guys organize functions that all need the same context (usually from tRPC)? For example lHow to get response type depending on the input params?Simple example of a normal JS function with generics: ``` const example = <T extends unknown>(paramshow to build tRPC and Prisma with express?I am using TSC as the official docs example does. But when I use paths in tsconfig.json, It does notHow to infer types from input?When I call my procedure from the client I send an array of strings as an input. How can I infer theHow to infer types of a queryCoinsider the example `const hello = trpc.hello.useQuery();` I would like to export the type we get Data Visualisation/Chartsis anyone using tRPC on data visualisation (say bar chart/line chart) in a scenario close to a bankitrpc + AWS Lambda (through cdk)Hi all, has anyone successfully integrated tRPC with AWS Lambda? My current stack is API Gateway + LIs it possible to narrow an output schema if the query optionally doesn't return all fields?I have a router procedure that has an input schema that has an optional `filter` that changes the shFetching different server url than defined in configIs it possible to access the reactQuery instance and fetch different server url? I would like to useinput using z.or not working properlyi have an input like this let input = z.object({ name: z.string().optional() }).or(z.object({ How can I disable batching with fastify adapter?I cant seem to find a way to disable batching for my server, and this link doesnt help me much httpsIssue with monorepo architecture ant tRPCHi, we had an issue with batched requests that if we batch some requests they produce a TRPCClientErUsing tRPC in CRON jobsHey everyone, this might be a very stupid question, but is it possible to use tRPC inside a CRON joasync createContext for Express AdapterBeen debugging an odd behavior for the past hour, it seems like that an async function does not workIs it possible to split the router definition with the imlementation?I want to define the server router(input\output\meta) in a separate package from the server package