DemocracyEarth / wallet

Censorship resistant democracies.
https://democracy.earth
MIT License
1.5k stars 286 forks source link

Exception while invoking method 'login' #426

Closed medied closed 5 years ago

medied commented 5 years ago

Blockstack Auth login fails with the following:

Exception while invoking method 'login' { stack: 'Error: key http://publik.ykliao.com must not contain \'.\'\n    at serializeInto

It seems the response payload comes back fine from Blockstack browser, issue is when Meteor attempts to insert user (see https://github.com/meteor/meteor/issues/3786, it doesn't like the dots)

Relevant code in branch bstack2

hstove commented 5 years ago

This looks like a classic MongoDB error. You're trying to insert a key in an object that has a . in it. Unfortunately, that's not allowed. I've encountered this as well.

You need to not store the full profile JSON as a mongoDB object, or serialize it in a way so that the key doesn't include a ..

Specifically, that means you have to change the way you store the apps object in a profile, because it will almost always contain a ..

medied commented 5 years ago

Awesome yeap, ended up serializing if with a specific key/pair format like suggested here. Assumption I made is that when apps has multiple keys the format will be like this:

apps:
     { 
       'http://publik.ykliao.com': 'https://gaia.blockstack.org/hub/1Auz184yJoPzQnhCbTma3TPNPwNqsC3MUB/',
       'http://TEST.TWO.com': 'https://gaia.blockstack.org/hub/1Auz184yJoPzQnhCbTma3TPNPwNqsC3MUB/'
     }

Thanks for the pointer @hstove