voryx / Thruway

PHP Client and Router Library for Autobahn and WAMP (Web Application Messaging Protocol) for Real-Time Application Messaging
MIT License
674 stars 117 forks source link

authid value returns "anonymous" no matter. #340

Closed cyprus1spirit closed 4 years ago

cyprus1spirit commented 4 years ago

No matter how I defined it in the javascript (autobahn-js) client in browser, authid always returns "anonymous". Any ideas?

I register the topic like this: $session->register('com.myapp.hello', [$this, "fetchUser"], ['disclose_caller' => true]);

and I get it in function:

function fetchUser($args, $kwArgs, $details){ echo $details->authid; }

my javascript (browser) spits the authid like this:

...
 var connection = new autobahn.Connection({
   url: 'ws://xxx.xxx.xx.x:8080/', 
   realm: 'realm1',
   authmethods: ["wampcra"],
   authid: "Mickey",
   onchallenge: onchallenge

}); 
...

my router is defined like this (whole code)

<?php

require 'bootstrap.php';
require 'InternalClient.php';

use Thruway\Peer\Router;
use Thruway\Transport\RatchetTransportProvider;

$realm = "realm1";
$router = new Router();
$InternalClient = new InternalClient($realm, $router->getLoop());

$transportProvider = new RatchetTransportProvider("0.0.0.0", 8080);

$router->registerModule($transportProvider);
$router->addInternalClient($InternalClient);

$router->start();

?>

Thank you in advance !

davidwdan commented 4 years ago

You're trying to use WAMPCRA authentication on the client but you don't have any authentication configured in the router.