Header redirect to oauth from a server


In my ionic app, I ask the user for username and password and redirect to my own server, where I verify if the user exists in the database. After verification, from my api.php file in my server, I want to call an external Oauth authorization page using header("Location= url…, However as soon as I add header redirect my app does nothing. I am following this tutorial “http://www.nikola-breznjak.com/blog/javascript/ionic3/posting-data-ionic-3-app-php-server/” and it works. Not able use header redirect. Can anyone help me on this?