Js-libjuju How to switch models without SSO popup?

Hello once more… this one I’m lost on.

If you use client.connectAndLogin to login to say wss://jimm.jujucharms.com/api it all works fine, then I pick another model and effectively just want to switch. When I run connectAndLogin a 2nd time I get the SSO popup again.

I wondered about just using a .connect and using whats returned there, but I don’t know if thats feasible. I also tried stuffing a macaroons object in to see if it prevented the popup but it didn’t.

What am I missing?

When calling connect multiple times you want to be sure that you’re using the same Bakery instance. We handle this in the examples by passing the same options object to all calls to connect: https://github.com/juju/js-libjuju/blob/master/examples/login-with-bakery.js#L18

Your hunch was correct @hatch getting it crowbared into React/Redux is fun, but I think I’ve got it sussed. Thanks for helping!

1 Like