ProtoLife / daptics-api

API documentation and clients for the daptics.ai design of experiments engine
https://daptics.ai
GNU General Public License v3.0
1 stars 1 forks source link

bug: login method should raise exception on invalid credentials #31

Closed nhpackard closed 3 years ago

nhpackard commented 3 years ago

[branch v0.12.0]

Trying to execute 03_SimpleTutorial.ipynb

on cell

name = datetime.now().strftime('Practice Session %Y%m%d-%H%M%S')
description = 'This is a practice session'
print('Session name = ',name)
daptics.create_session(name, description);

get:

Problem creating session!
Error: Argument "session" has invalid value $session.
In field "userId": Expected type "String!", found null.
Hint: session name may have already been taken, in which case choose another one.

problem is that $session is not filled in...

daptics.print()
client_version =  0.12.0
host =  https://api.daptics.ai
credentials =  None
options =  {'auto_export_path': None, 'auto_generate_next_design': False, 'auto_task_timeout': None, 'run_tasks_async': False}
user_id =  None
session_id =  None
session_name =  None
session_tag =  None
task_info =  {}
gen =  -1
remaining =  None
completed =  False
Experimental Space Definition: None
Design: None
Experiments History: None
Analytics: None

user_id and other session info are not present, and looked for later.

nhpackard commented 3 years ago

I added a print statement to DapticsClient().login()

...
        data = self.execute_query(doc, vars)
        if 'login' in data and data['login'] is not None:
            self.auth.token = data['login']['token']
            self.user_id = data['login']['user']['userId']
        else:
            print('login:  no data returned from execute_query()')
        return data
...

and sure 'nuff, the print statement prints. So... execution of the Login mutation is not returning data with login info (auth token, userID).

pzingg commented 3 years ago

I will change the login API to return errors, like "email and/or password credentials are invalid".

nhpackard commented 3 years ago

but... the credentials are valid. maybe db sync problem to inertia?

Maybe we need to fire up the admin ui to check users on inertia.

pzingg commented 3 years ago

Should be fixed in PR #30