How to Login from Code

The current JavaScript libraries handle password authentication as necessary to authorize query white-listing, but if you wish to obtain authcodes programatically, you can:

The two necessary fields are 'email' and 'password'. This python example snippet would return the JSON as text.

                def login(id, email, pw):
                    flds = {'arg:email': email,
                            'arg:password': pw}
                    url = 'https://www.rdbhost.com/acct/login'
                    r = requests.post(url, data=flds)
                    return r.content

                val = login('who@example.com', 'secret')
                print val
            

If the login succeeds, all roles and authcodes are returned as a JSON dictionary.

                {
                    "roles": { "p": [ "r0000000002", "-" ],
                    "r": [ "r0000000002", "-" ],
                    "s": [ "s0000000002", "qTP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~y12Q" ]
                },
                    "status": [ "complete", "OK" ]
                }