Add login to blueapi - #70
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
==========================================
- Coverage 94.06% 93.36% -0.70%
==========================================
Files 26 27 +1
Lines 1415 1493 +78
==========================================
+ Hits 1331 1394 +63
- Misses 84 99 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ZohebShaikh
left a comment
There was a problem hiding this comment.
Apologies for the late review, I had it on my mind on Friday but couldn't get to it.
The PR looks good
| self.setLayout(layout) | ||
|
|
||
| def _on_click_trigger_login(self): | ||
| self.client.client.login() |
There was a problem hiding this comment.
This should have a try and except. and the errors should be provided in a dialog box.
Also, could you display the "Please log in" message in the dialog box? Alternatively, you can replace it with this message.
Logging in
Please login from this URL:- http://localhost:8081/realms/master/device?user_code=THHA-EWNF
| self.setLayout(layout) | ||
|
|
||
| def _on_click_trigger_login(self): | ||
| self.client.client.login() |
There was a problem hiding this comment.
Another thing is when you are logged in. The only feedback you get is Logged In in the console(CLI)
It will be nice if the Please login window is replaced by Logged in as fedid, This can also stay on the top corner all the time in the main window
You can find the fedid of the person logged by
- decoding the access token
- Then getting fedid from the claims
| if self.login_dialog.isVisible(): | ||
| self.login_dialog.close() | ||
| tidy_up_logging([self.gui_logger]) | ||
| print("PLEASE LOG OUT FROM BLUEAPI") |
There was a problem hiding this comment.
The cache is getting stored at ~/.cache/blueapi_cache. It would be nice you could get this stored in memory.
This will be a change in blueapi. You will need to create a new In memory Cache.
Then once the UI process terminates the cached tokens are also gone, because my assumption is that people are logging in as a shared user on some i19 beamline computer.
… trying to figure out how to decode the token
Closes #64