I am currently in the process of designing architecture which allows my client websites to communicate with a master RESTful API
secured by Basic Authentication on another server using a cross origin header.
When users register on one of the websites the form is posted to a PHP file
that then creates a stream and posts the data over to the API
on the master server (both servers are SSL secured).
The issue comes after this. With each request to the API
I need to re-provide the users' username and password in order to successfully authenticate them through Basic Authentication.
How can I safely store the username and password of the user so that I can continue to provide the client website with access to the API whilst the user makes changes to their account?
Would it be considered secure enough to store an encrypted username and password in session variables? Users will be passing sensitive information such as a credit card number through to the master API
so security is top priority.