vue-wamp
vue-wamp copied to clipboard
How to change the authid
Currently, it's not possible to change the authid after the VueWamp object creation. Maybe by redoing the Vue.use...
?
A cleaner way would be to handle it directly in the plugin.
Im not sure you should be able to change that... authid is a response by the router after authentication, clients should not be able to change it.
Is it possible with AutobahnJS to change the authid on demand after successfully connecting?
Yeah, you can't change the authid after login. My use case is that I use the authid as username and token challenge as password for a web interface. I manually close the session and reopen a new one.
Yeah, you can't change the authid after login. My use case is that I use the authid as username and token challenge as password for a web interface. I manually close the session and reopen a new one.
Any news on this issue? I am trying to do something similar. Where I have a login workflow. When the webpage is loaded, it uses a anonymous authentication, then the user try to click a login button to login with authid and password.
So in that case, how to handle the authentication options? I tried to do a reconnect, but having problem with pass the new options and to force autobahn to reconnect.
As far as I know, you SHOULD NOT change the authid from the client side. It might not even be possible. Just imagine a hacker changing the authid on demand.
Authid is provided by the registered dynamic authenticators, or the static rules in the config.
Closing this issue as it is unsupported by crossbar
You can, if you disconnect then reconnect. An easy way to do that would be handy.
@Yamakaky could you paste in a code snippet of your re-auth process?
export const reconnect = (() => {
let connection
return () => {
if (connection) {
// Throws if already closed
try {
connection.close("closing_old_connection")
} catch (e) {
console.error(e)
}
}
return new window.Promise((resolve, reject) => {
const url = ...
const realm = ...
connection = new autobahn.Connection({
url,
realm,
authmethods: [
"cookie",
],
authid: username,
onchallenge: onchallenge,
})
connection.onopen = (...args) => {
onopen(...args)
resolve()
}
connection.onclose = (...args) => {
reject()
onclose(...args)
}
connection.open()
})
}
})()