cómo obtener respuesta solo solicitud de javascript procesada

I have a service url that includes username password like this: http://service.com/token?username=asd&password=123 But I can not send a request from javascript, because username and password is appearing from browser source code. So I created a Proxy page on server that sends request to service and gets token like this: http://mydomain.com/Token/GetToken I created an index page http://mydomain.com/index.html and javascript code sends request to Proxy page and gets token.

But somebody write a server page that sended request to my Proxy page (http://mydomain.com/Token/GetToken). And can get token.

I want to that only my rendered pages should send request to my Proxy page. Is this possible?

I am using .net mvc Project.

preguntado el 02 de diciembre de 13 a las 08:12

You can check from which host the request is coming. In http request host name will be specified. If it is not from your server simply return some 401. -

1 Respuestas

The general approach is to use an existing authentication framework to protect http://mydomain.com/Token/GetToken.

If you're using a PHP backend I suggest uIniciar sesión

Respondido el 02 de diciembre de 13 a las 08:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.