Callback in oauth2 in Ionic v3,v4

Hi All
Can someone help me that
1.How to implement callback in oauth2 in ionic v3,v4

Present Workflow
1.From ionic app I am redirecting to other url for login using Inappbrowser
2.In auth url I added redirect_url as localhost

What is happening
Its not redirecting to ionic app after authorization

What should happen
It should redirect to ionic app and post code so that I can use it for retrieving token.

Note: I also used ssl=true but it not helped bcz portal only accepting https scheme.