How to avoid logging out a user when using their credentials via the new REST API

Post originally written by John Mertic.

I had this question come from a partner this week...
Users can't maintain their two sessions of Sugar (One via the REST API, and the other their Sugar Instance) at the same time. Signing in to either one will always result to the session expiration of the other one

This is mostly because the Sugar 7 uses the same REST API to power all the new Sugar UX components, so if you need to let the API know you aren't coming from the desktop client. The way to do this in as a part of the /oauth2/token call, changing the 'platform' parameter as shown below to something other than 'base', 'mobile', or 'portal'...

gistfile1.json

{
"grant_type":"password",
"client_id":"sugar",
"client_secret":"",
"username":"admin",
"password":"password",
"platform":"myspecialapp" // change 'myspecialapp' to whatever you want to refer to your app as
}