Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Add device_id support to /login #929
Conversation
richvdh
assigned
erikjohnston
Jul 18, 2016
|
hrm, will investigate sytest fails |
erikjohnston
commented on the diff
Jul 19, 2016
erikjohnston
commented on the diff
Jul 19, 2016
| + Raises: | ||
| + StoreError: if ignore_if_known is False and the device was already | ||
| + known | ||
| + """ | ||
| + try: | ||
| + yield self._simple_insert( | ||
| + "devices", | ||
| + values={ | ||
| + "user_id": user_id, | ||
| + "device_id": device_id, | ||
| + "display_name": initial_device_display_name | ||
| + }, | ||
| + desc="store_device", | ||
| + or_ignore=ignore_if_known, | ||
| + ) | ||
| + except Exception as e: |
erikjohnston
Owner
|
|
Do we actually use the fact that |
Well, certainly at this point, the registration flow still generates access_tokens without device_ids. In general, I'm not confident in my ability to comb exhaustively through the code (yay dynamic languages) and make sure that a device_id is generated in all the places we need one, and would rather be a bit defensive and try to make sure that things keep working rather than throwing runtime exceptions. |
|
LGTM (Would be good to see some sytests that hit the code paths) |
richvdh commentedJul 18, 2016
•
edited
Add a 'devices' table to the storage, as well as a 'device_id' column to refresh_tokens.
Allow the client to pass a device_id, and initial_device_display_name, to /login. If login is successful, then register the device in the devices table if it wasn't known already. If no device_id was supplied, make one up.
Associate the device_id with the access token and refresh token, so that we can get at it again later. Ensure that the device_id is copied from the refresh token to the access_token when the token is refreshed.
(Next step in this process will be to also support 'device_id' in the registration API).