Wamp.error.authentication_failed

I’m developing a Vue.js app and I’m getting an authentication error while trying to connect to an existent autobahn server.

DEPENDENCIES:

“autobahn”: “^20.2.2”,
@types/autobahn”: “^18.10.0”,

ERROR:

connection closed closed {
   reason: "wamp.error.authentication_failed"
   message: "got invalid return type "<class 'bool'>" from dynamic authenticator"
   retry_delay: null
   retry_count: null
   will_retry: false
}

CODE:

const autobahn = require('autobahn');
var connection = new autobahn.Connection({
  realm: 'realm1',
  transports: [
    {
      'type': 'websocket',
      'url': 'wss://homeendpoint.bigoddsapposta.pt/ws'
    },
    {
      'type': 'longpoll',
      'url': 'https://homeendpoint.bigoddsapposta.pt/ws'
    }
  ],
  authmethods: ['wampcra']
});

The issue that you are facing is not related to VueJS at all. The problem is happening because you are not providing the authentication values for wampcra. You need to provide authid and an on_challenge callback. See here for more details https://crossbar.io/docs/Challenge-Response-Authentication/#javascript

You were absolutely right!
I did those changes and moved the configuration code block inside the user login confirmation so I can have the “authid”.

Previous implementation of the app was using vue-wamp plugin, which pretty much did everything for me. But now I can’t seem to have this plugin working with typescript so I’m back to “raw” autobahn.js.

Thanks for your help!