cloudentity / oauth2c

User-friendly OAuth2 CLI
https://cloudentity.github.io/oauth2c/
Apache License 2.0
741 stars 29 forks source link

Enable using in scripts #76

Closed schlomo closed 1 year ago

schlomo commented 1 year ago

This is a very useful tool which helped me to quickly play around with different OAuth2 configurations - thanks a lot!

Currently all console output goes to stdout, mixing both the token result and the diagnostic output. In --silent there is no diagnostic output whatsoever, which makes it hard to debug errors.

To enable using oauth2c in scripts please separate write all diagnostic output to stderr, leaving only the JSON with the token data on stdout. Also, it would be nice to see the login progress without dumping the token info.

mbilski commented 1 year ago

I make all debug go to stderr in https://github.com/cloudentity/oauth2c/pull/77

Please take a look.

What do you mean by so see the login progress without dumping the token info.?

schlomo commented 1 year ago

@mbilski wow, thanks. Exactly what I meant.

ATM without --silent, it dumps everything which is more like debug mode. What I mean is to (and maybe this is a new feature) to add a --verbose mode that would print useful progress info without dumping all the data going forth and back. It should be the same as now without the silent flag, but hide the details and fit into a couple of lines.

The usage would be in scripts that need to login and get a token. STDOUT would be used to capture the token data, and STDERR shown to the user to display that verbose progress info without leaking any sensitive data and without showing all the details that are not relevant to see the progress or where the login was aborted, e.g. because after timeout the redirect call back didn't receive anything.

Thanks a lot for the quick implementation!