How can I detect if a front end token is available to execute? Alternately, how can I detect if a front end token failed to execute?
Example: the Edit -> Copy command is not available if nothing is selected. FrontEndTokenExecute["Copy"]
will simply beep in this case, but it gives me no (programmatic) indication that it has failed.
The easiest way is to just try to call the service with it. It will reject it if it is expired and then you can request a new one. You can also keep the time you received the token and use the expires_in to calculate when it will approximately expire.
To verify JWT claimsVerify that the token is not expired. The aud claim in an ID token and the client_id claim in an access token should match the app client ID that was created in the Amazon Cognito user pool. The issuer ( iss ) claim should match your user pool.
I found a method to deal with your second question, but it's not elegant:
Preferences > Interface > Message and Warning actions
set Minor user interface warnings to Beep and Print to Console Notebooks[]
or so)NotebookGet[NotebookObject[FrontEndObject[LinkObject["55d_shm", 1, 1]], 1]]/. Notebook[{___, Cell[a___]}, ___] :> Cell[a]
(your handle will look differently, of course)Cell["You tried to edit a cell that is not editable. You can make the \
cell editable by choosing Cell Editable in the Cell Properties \
submenu.", "Message", "Message", "MSG", PageWidth -> WindowWidth,
ShowCellLabel -> True, CellChangeTimes -> {3.534442831*10^9},
CellTags -> "cantEditLockedCell"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With