Open xhh opened 7 years ago
I figured out that you have to return a std::tuple
of a std::map
:
std::map<std::string, std::string> result;
result["secret"] = secret;
result["role"] = role;
result["salt"] = salt;
invocation->result (std::make_tuple (result));
Yeah, a dynamic authenticator is supposed to return a single positional value (hence the tuple of length 1), and that value needs to be a map. Sorry for leaving you in the rain and guessing ..
We should add an example. We have one for authenticating a client (https://github.com/crossbario/autobahn-cpp/blob/master/examples/wampcra.cpp), but we don't have one for a dynamic authenticator in C++
As described in Corssbar WAMP-CRA dynamic authentication docs:
The authentication procedure I registered is defined as this (the result is a
std::map
):And I got this error with the client trying to authenticate via the WAMP-CRA authentication:
RX message: abort [{"message":"got invalid return type \"<class 'autobahn.wamp.types.CallResult'>\" from dynamic authenticator"}, "wamp.error.authentication_failed"]
How shall I return the secret and role in the authenticate procedure here? Can't find any example code, please allow me asking here.