backbone
backbone2y ago

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

SSO callback my api like api/trpc/user.login?token=abc
5 Replies
Nick
Nick2y ago
Could you describe your problem in more depth?
backbone
backboneOP2y 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
Nick
Nick2y 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
backbone
backboneOP2y 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.
Nick
Nick2y 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