How to have an (older) RPC log in?

10 views
Skip to first unread message

Wouter Hendriks

unread,
Jul 21, 2025, 10:36:01 AMJul 21
to General WebHare developers discussion
The new WRD auth in 5.8 seems to have broken my RPC login.

I have this RPC defined:

    <webservice name="frontendapi"
                crossdomainorigins="*"
                library="frontendapi/frontendapi.whlib"
                prefix="rpc_"
                primarytrans="auto"
                requirewhaccount="false"
                transports="jsonrpc">
      <accesscheck />
    </webservice>

And wrdauth in siteprl:

  <apply>
    <to type="all" sitemask="Stagedriver*" />
    <wrd:wrdauth wrdschema="stagedriver:stagedriver"
                 cookiename="webharelogin-stagedriver-4123125123"
                 nohttponlycookies="true"
                 samesitecookie="none"
                 />
  </apply>

Login function:

this->auth->Login(email, password)

this->auth comes from webdesign->GetWRDAuthPlugin().

RPC is doing:

auth->Login(email, password)

However, doesn't work anymore.

This can be traced back to this CallJS in /wrd/lib/internal/auth/webdesignplugin.whlib:

RECORD result := CallJS("@mod-platform/js/auth/harescript.ts#login", this->webcontext->baseurl, returnto ?? this->webcontext->baseurl, loginname, password, GetTidLanguage(), options.remoteip, agent, options.persistent);

In my case, this->webcontext->baseurl refers to `'http://127.0.0.1:8000/wh_services/stagedriver/`.

Which results in the WRD functions to get the system:usermgmt WRD schema.

Question is: how to tell WebHare that it should use a different WRD schema? Afaik, I can only use siteprofiles for this, which doesn't help for wh_services links.

Arnold Hendriks

unread,
Jul 22, 2025, 5:25:55 PMJul 22
to General WebHare developers discussion, Wouter Hendriks
> this->auth comes from webdesign->GetWRDAuthPlugin().

How does the RPC get a webdesign? And why is the baseurl incorrect ? 

Wouldn't

PUBLIC OBJECT FUNCTION GetWRDAuthPlugin(STRING url, RECORD options DEFAULTSTO DEFAULT RECORD)

with the proper URL of the website work ? That one creates a webcontext directly and just passes the url as baseurl

> Question is: how to tell WebHare that it should use a different WRD schema

That's not enough, as the cookiename= (and eg loginpage=) can currently only be found in the siteprofile rules. Ideally we would only use wrdschema .. but you'd quickly need the language code too for many APIs and a way to get the loginpage per wrdschema + language code combination

Wouter Hendriks

unread,
Jul 23, 2025, 4:25:36 AMJul 23
to General WebHare developers discussion, Arnold Hendriks, Wouter Hendriks
Ah, yes, this works like a charm:

PUBLIC OBJECT FUNCTION GetWRDAuthPlugin(STRING url, RECORD options DEFAULTSTO DEFAULT RECORD)

Didn't know that existed.

Thanks!


Reply all
Reply to author
Forward
0 new messages