There is not chance to send username and password directly to authentication server. Page with login form is send by authentication server to you and you have to show it to user which fill username and password and send it back to authentication server.
Authentication server send result of user authentication back to your application.
You can use refresh token by selected offline access scope. This token has long expiration time (I think 3 months). But you need log into first and then again when refresh token expires.
I wrote Windows Live Framework, it is easy to connect into OneDrive and manage login form.
https://www.nuget.org/packages/WLive/