Yea, you could do it. In the simplest case, you could build a login form (e.g. winforms) in code in your script and use it to get the username and password from the user.
In a more serious use case, you could build your login form and all the login logic in a separate dll, and just call that dll from your scripts.
If you'd like to try this, let me know via email (antonio at querystorm.com), I can help or at least point you in the right direction.
Re:Show HN: C# support in Excel
by lowkeyokay on Friday November 10, 2017 @03:39PM
(#15672789)
Thanks! Will do.
Of course, the user could just enter credentials in cells, but if I want something more secure. Is there any way to integrate an OAuth 2 log in form or similar?