How to Login from Code
Once you have logged in, you can obtain authcodes for each role. The authcode can be hard-coded into your code with the role name, and the login is unnecessary.
JSLogin
If you wish to avoid pasting authcodes into your code, you can ask the user for the account name password, and login using the /mbr/jslogin page.
The two necessary fields are 'email' and 'password'. This python example snippet would return the JSON as text.
def login(email,pw):
flds = [ ('email', email),
('password', pw) ]
postdata = urlencode(flds)
url = 'https://www.rdbhost.com/mbr/jslogin'
headers = {'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': str(len(postdata))}
r = Request(url, postdata, headers)
pg = urlopen(r)
text = pg.read()
return text
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" ]
}
