Thanks Francesco - I didn't realize that the base64-decoded value was in
fact the
json-serialized macaroon.

Now I have valid macaroons, but I'm still getting the "redirection
required" error
message back from the Login api, and I have no idea why. Digging around in
juju
code trying to figure it out, but if anyone has any pointers that'd be
great.


On Sat, Nov 5, 2016 at 6:44 PM, Francesco Banconi <
[email protected]> wrote:

>
> > On 5 Nov 2016, at 23:07, Tim Van Steenburgh <
> [email protected]> 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
>
>
>
>
>
-- 
Juju mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju

Reply via email to