I need to open it because it needs interaction with the user, so he can login in his account using OAUTH method, and then my program will receive a token, via a localhost server configured as the redirect_uri for the OAUTH process. This is the most convenient method I've found so far.
When the library is finished, the browser part will be handled by the program that uses it, e.g. opening a webview, but until then it is very convenient to do it all from the same code.