通过ajax请求发送Symfony2凭据

this is my scenario:

2 domains: - 1 that contains the frontend system with a credential system. - 1 that contains the rest api the frotend needs.

All the request in the fronted are made via $.ajax (jquery).

The users have a token in the frontend domain, so i need to send it to the webservices, to let them validate those credentials and response according to it.

Any ideas?

Java Web Tokens represent a good solution to this. First authenticate the user with their username / password at a dedicated login url, this returns a token which you can send for verification in further requests.

The LexikJWTAuthenticationBundle provides a nice JWT integration for Symfony. Ideal for providing authentication in RESTful web services.