Authentication using web services depends either on the HTTP / Soap protocols or in the service contract (a token is usually used).
The solution based on the first call, which receives the identifier and then exchanges the session identifier, is good for a call on the client side (which does not have access to HTTP / Soap protocols, only service parameters, in this case you usually use light Web services based on Rest).
A business party call can also be based on Basic Authentication or WS-Security. Ebay uses your approach for its web services, which are usually called from business applications (and not directly from the clientβs browser).
One consequence is that the server and client must support the session token. Ultimately, you'll need a revocation service that logs out (preventing reuse of the login token).
Basic approach for cross domain. Javascript HTTP request registered here
source share