OpenAPI TS login

17 views
Skip to first unread message

Wouter Hendriks

unread,
Oct 21, 2024, 1:54:52 PM10/21/24
to General WebHare developers discussion
I'm trying to implement a (simple) login with OpenAPI and TS but have no idea where to start. As far as I can tell this can't be done (yet), but that can't be right.

Trying to implement a POST request:

  /login:
    post:
      x-webhare-implementation: api.ts#login

In HareScript RPCs I would just use wrd/lib/internal/auth/webdesignplugin.whlib / wrd/lib/auth.whlib but in this case, I want to use TS and support login for a frontend outside of WebHare.

Don't think I can use @webhare/frontend, as that's only for frontends in WebHare?

Does somebody have any hint?


Arnold Hendriks

unread,
Oct 21, 2024, 2:40:50 PM10/21/24
to General WebHare developers discussion, Wouter Hendriks
There's no direct support for letting a frontend user login to an OpenID API. Normally a user would get an authorization token through a bespoke API or through oauth2/openid (if a third party authenticates) 

(because if you're using @webhare/frontend to login, you would likely already be using WebHare as both frontend and backend for login an your services, so why not connect using jsonrpc? openapi would only be adding overhead during development and during request processing because of the extra validation)

You can probably do it using getRequestUser from @webhare/wrd but I've only used that with json/rpc services.



Reply all
Reply to author
Forward
0 new messages