Actually you are trying to make use of Remote Authentication of SharePoint Online. You have basic details.
So you have to make use of the following web service call to authenticate SPO using non server side solution.
It will be a soap request.
You can refer this answer for in-depth information about remote authentication of SPO.