Search code examples
angularauthenticationangular2-servicesangular2-jwt

How to submit Form method = post to different server in Angular2


My Form post

<html>
<head>
    <title>Submit this form</title>
</head>
<body>
    <form method="post" action="http://localhost:4200/callback">
        <input type="hidden" name="access_token" value="eyJ0" />
<input type="hidden" name="token_type" value="Bearer" />
<input type="hidden" name="expires_in" value="3600" />
<input type="hidden" name="scope" value="read write" />
<input type="hidden" name="state" value="Ra7JV" />
    </form>
</body>
</html>

and when ever the http://localhost:4200/callback is called navigate to callbackComponent. but here it unable to navigate to callbackComponent showing Cannot POST /callback.

How could I catch the post form in my angular2 CallbackComponent.


Solution

  • This is for Newbies like me :

    To achieve this I wrote server side code -> node.js(express) where app.post('/callback') doing my part and redirecting to my client side.