Ionic 3 Add Custom script in ionic serve

I am using Ionic 3 via CLI.

while using ionic serve i want to add custom scripts “auth” which prompt for username password and create cookie using api and use this cookie while calling each API.

I created custom server task in grunt which prompt user for login and create cookies and apply this cookie with each request and able to manage run with ionic from package.json.

grunt.registerTask(‘server’, [‘checkAuthToken’, ‘applyAuthToken’,‘configureRewriteRules’, ‘configureProxies’]);

“scripts”: {
“auth”: “grunt server”,

Now i am wondering how to import this auth task before ionic serve so my proxy and authentication works.

I tried with below script it prompt for username password create cookies but my proxy wont work because my grunt task is run after ionic watch and before ionic build so it won’t work

"ionic:serve": "ionic-app-scripts serve && grunt server"
"ionic:serve": "grunt server && ionic-app-scripts serve"