Redirect to ERP after login API

Hi, I have one question regarding auto login. I have a system which wish to connect with the ERP system. The system I written is in PHP language. I have a script which will request the login API, and then redirect to the ERP site. But whenever how I tried. It will jump back to the login page after redirect. I want to redirect it into the ERP system without having to fill in the login credentials again. How can I do it? Thanks for any advices.