You do not do this; You are using OAuth for authentication. Providing third-party sites with username and password authentication is a terrible security flaw and Twitter will no longer allow it.
See Twitter OAuth Doc for Authentication.
EDIT: Twitter still supports the 'xAuth' option , which allows authentication with a username and password. You need to get special permission from Twitter to use it.
source share