Open-EO / openeo-r-client

R client package for working with openEO backends
https://open-eo.github.io/openeo-r-client
Apache License 2.0
61 stars 17 forks source link

Always show a URL in Jupyter #131

Closed m-mohr closed 2 years ago

m-mohr commented 2 years ago

Not tested yet. We need to test a locally hosted Jupyter and a remote one.

Related: #119

We need to check whether we run into this issue again: https://github.com/r-lib/httr2/pull/103

Maybe we can remove the code completely?

flahn commented 2 years ago

A similar issue might occurs, when you try to login in pure R.

Copy <anonymized> and paste when requested by the browser
Press <enter> to proceed:
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'https://aai.egi.eu/auth/realms/egi/device?user_code=<anonymized>'
✔ Waiting for response from server [1m 12.7s]

There are error messages and at the end, where you can copy/paste the link. I'm not sure if we can somehow query the R system if a browser is installed.

flahn commented 2 years ago
options("jupyter.in_kernel"=TRUE)
connect("openeo.cloud")
login()

This fails: Login failed. Reason: OAuth 2.0 device flow requires an interactive session

flahn commented 2 years ago

I guess the interactive requirement for the check is preventing the rest of the code from running:

https://github.com/r-lib/httr2/blob/487c23e203e38539198432c025fc16b48bf2d498/R/oauth-flow-device.R#L61

m-mohr commented 2 years ago

Yes, this is probably why we set interactive to TRUE back then.

So this really needs a better implementation in httr2, I think? At least try/catch the browser code and if it fails show the URL so that you don't get stuck?!

flahn commented 2 years ago

https://github.com/r-lib/httr2/issues/170