Piston can take care of authentication for you. Most securely With Oath.
Piston also supports basic http authentication, which sends username and password with the url.
So what you want is already there, I guess you are reinventing the wheel..
External apps don't need to know the username and password for a user if you use Oauth. That's why oauth is invented.
HTH
Stephan.