SugarCRM/SuiteCRM Api Login redirect

I am using the v4_1 Rest API from Sugar/Suite CRM to login:

I have taken this php code and created a loginAuth.php script and put the credentials for a user in it… It works and returns me a session id…

My problem now is I don’t know what to do with the session id I get back… I try to redirect the main page, but it takes me back to the login screen…


call loginAuth.php (validate/get sessionid)
if valid session, redirect to index.php?module=Home&action=index
But it’s just taking me to the main page…

Any ideas on how I can bypass the login form when using the API?



Ok, I figured it out… There are two cookies that get set:




but you have to send MSID to the index.php page FIRST… So simply add this line to the bottom of the php script:

header(“Location: http://{site_url}/index.php?MSID=$session_id”);

and it will bypass the login…