Authenticating to model on shared controller
Francesco Banconi
francesco.banconi at canonical.com
Sat Nov 5 22:44:51 UTC 2016
> On 5 Nov 2016, at 23:07, Tim Van Steenburgh <tim.van.steenburgh at canonical.com> wrote:
>
> Can anyone tell me how the macaroons in ~/.go-cookies are encoded? If I try to
> deserialize the 'Value' value directly (using libmacaroons), I get an 'invalid macaroon'
> error. I also tried base64-decoding the value first, and that didn't work either.
Decoding the cookie values with base64 should work for that.
I just quickly tested that the following works locally with Python3 for instance:
import base64, json, os
cookies = json.load(open(os.path.expanduser('~/.go-cookies')))
values = [c['Value'] for c in cookies if c['Name'].startswith('macaroon-') and c['Value']]
macaroons = [json.loads(base64.b64decode(value).decode('utf-8')) for value in values]
--
Francesco
More information about the Juju
mailing list