Services api set browser cookie I would like to use Services to programmatically login a user from another website.

So for example if site.example.com uses the services login endpoint on example.com in Chrome, when that user moves over to example.com they will already have a valid session and cookie for accessing the site.

I have looked into adding the cookies.txt file via my CURL request, and have tried the various different Drupal authentication method like user_login_submit() and drupal_session_regenerate() but none of them are working.

When i navigate over to example.com the user is still seen as being anonymous.
Just for anyone who is looking to implement something similar, i done this using a http redirect to an authentication page, passing and authenticated using the token generated from drupal_get_token() (important not to use the session id).

The important steps to follow are to override the GLOBAL $user with the newly generated session user details and then regenerate the session using drupal_session_regenerate().