ApproachTo Hit A Third Party Web Service That Returns A 302 / Redirect
What would be a way (or best practice) to hit a third party web service (https://www.thirdParty.com/API/authentication) with POST that includes a specific set of parameters. The parameters will in开发者_StackOverflow社区clude typical authentication info like token, user, email, etc, and if the third party service authenticates me successfully it will return a 302 Found Response which should then redirect to an appropriate third party source web page.
A friend of mine suggests to use Ajax behind the scenes and redirect when there is a 302, but I'm not sure of the correct way to do this.
If you POST to the third party service and it issues a 302, then the browser will automatically follow the redirect.
There's is no need for any AJAX, you can issue that POST directly from the HTML form, assuming to have suitable levels of encryption to protect this data (SSL).
精彩评论