<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/4511/user-logout-issues-when-using-rest-ap</link><description>In my plugin, I&amp;#39;m using the SugarCRM function SUGAR.App.api.getOAuthToken() for querying any data (get/post) on each ajax call of SugarCRM v10 REST API. Below is the piece of ajax request code 
 $.ajax({ beforeSend: function(request) { request.setRequestHeader</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22628?ContentTypeID=1</link><pubDate>Tue, 02 Mar 2021 13:58:23 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:7039a4c1-917f-43fe-87ca-1b71a85a02ca</guid><dc:creator>Rishabh Srivastava</dc:creator><description>&lt;p&gt;Ok thanks, I will try and let you know.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22560?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 13:11:05 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:8a6e74c6-bd10-4c3f-92ac-2d9a3ef2cc4e</guid><dc:creator>Jeroen Somhorst</dc:creator><description>&lt;p&gt;The question is where this is running. Inside sugar? And if yes why aren&amp;#39;t you using the sidecar framework?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22549?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 17:22:54 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:7e5bdcff-fdf8-4a57-bff5-b07f63bc72f6</guid><dc:creator>Rishabh Srivastava</dc:creator><description>&lt;p&gt;Hi Jeff,&lt;br /&gt;&lt;br /&gt;thanks for the reply.&lt;br /&gt;&lt;br /&gt;There are two ways to obtain the access token&lt;br /&gt;1-&amp;nbsp;rest/v10/oauth2/token via rest API by using the API platform and its responses are&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;div class="json-viewer style-scope node"&gt;&amp;quot;&lt;span class="json-viewer style-scope key-name"&gt;access_token&lt;/span&gt;&amp;quot;: &amp;quot;xxxxxx&lt;span class="json-viewer style-scope stringValue"&gt;-yyyy-zzzz-b1ef-aaaaadb&lt;/span&gt;&amp;quot;&lt;span class="json-viewer style-scope punctuation hidden"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div class="json-viewer style-scope node"&gt;&amp;quot;&lt;span class="json-viewer style-scope key-name"&gt;expires_in&lt;/span&gt;&amp;quot;:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="json-viewer style-scope numeric"&gt;3600&lt;/span&gt;&lt;span class="json-viewer style-scope punctuation hidden"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div class="json-viewer style-scope node"&gt;&amp;quot;&lt;span class="json-viewer style-scope key-name"&gt;token_type&lt;/span&gt;&amp;quot;: &amp;quot;&lt;span class="json-viewer style-scope stringValue"&gt;bearer&lt;/span&gt;&amp;quot;&lt;span class="json-viewer style-scope punctuation hidden"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div class="json-viewer style-scope node"&gt;&amp;quot;&lt;span class="json-viewer style-scope key-name"&gt;scope&lt;/span&gt;&amp;quot;:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="json-viewer style-scope nullValue"&gt;null&lt;/span&gt;&lt;span class="json-viewer style-scope punctuation hidden"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div class="json-viewer style-scope node"&gt;&amp;quot;&lt;span class="json-viewer style-scope key-name"&gt;refresh_token&lt;/span&gt;&amp;quot;: &amp;quot;&lt;span&gt;nnnnn&lt;/span&gt;&lt;span class="json-viewer style-scope stringValue"&gt;-yyyy-zzzz-b1ef-aaaaadb&lt;/span&gt;&amp;quot;&lt;span class="json-viewer style-scope punctuation hidden"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div class="json-viewer style-scope node"&gt;&amp;quot;&lt;span class="json-viewer style-scope key-name"&gt;refresh_expires_in&lt;/span&gt;&amp;quot;:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="json-viewer style-scope numeric"&gt;1209599&lt;/span&gt;&lt;span class="json-viewer style-scope punctuation hidden"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div class="json-viewer style-scope node"&gt;&amp;quot;&lt;span class="json-viewer style-scope key-name"&gt;download_token&lt;/span&gt;&amp;quot;: &amp;quot;&lt;span&gt;mmmmm&lt;/span&gt;&lt;span class="json-viewer style-scope stringValue"&gt;-yyyy-zzzz-b1ef-aaaaadb&lt;/span&gt;&amp;quot;&lt;/div&gt;
&lt;p&gt;&lt;span&gt;}&lt;br /&gt;&lt;/span&gt;&amp;nbsp;and from here we can use access_token for Sugar rest v10 API(Get/Post)&lt;br /&gt;&lt;br /&gt;2- by using directly&amp;nbsp;SUGAR.App.api.getOAuthToken() in javascript file, this function also provides the&amp;nbsp;&lt;span&gt;access_token and we can&amp;nbsp;use access_token for Sugar rest v10 API(Get/Post).&lt;br /&gt;&amp;nbsp;And in our plugin, most of the code has been done js side.&lt;br /&gt;&lt;br /&gt;Can you please suggest which option will be better?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;And strange only one sugar client reported this issue, other sugar clients using the plugin without any issue.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22548?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 16:59:27 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:69a8e773-b18e-446d-895d-75a511803ea5</guid><dc:creator>Rishabh Srivastava</dc:creator><description>&lt;p&gt;code is using in sugar only. We just hits the function&amp;nbsp;SUGAR.App.api.getOAuthToken(). and whatever it returns the OAuth token, we use that token for the Rest API.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22547?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 16:44:08 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9f456ed2-8a4a-4824-9310-f944cc52c9aa</guid><dc:creator>Jeff Bickart</dc:creator><description>&lt;p&gt;If you are attempting to use the code inside of Sugar; we don&amp;#39;t use $.ajax calls. Sugar has a very robust framework called Sidecar to work with all of the data in Sugar.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You should read the &lt;a href="https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.1/User_Interface/Dashlets/"&gt;Dashlet Developer&amp;#39;s Guide&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22545?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 16:42:42 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:00396a87-b4d7-4303-8358-d8fae3328a8c</guid><dc:creator>Jeroen Somhorst</dc:creator><description>&lt;p&gt;This is expected behaviour. When you retrieve a new token for a user you will log them out if you are on the same platform. Where is this code running? Inside sugar? outside , in a different web app?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22546?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 16:42:38 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:46685e9d-8f38-4928-a8ce-c7be853d9d04</guid><dc:creator>Jeff Bickart</dc:creator><description>&lt;p&gt;Documentation on &lt;a href="https://support.sugarcrm.com/Documentation/Sugar_Versions/10.0/Ent/Administration_Guide/Developer_Tools/#Configure_API_Platforms"&gt;Configure API Platform&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: user logout issues when using REST AP</title><link>https://sugarclub.sugarcrm.com/thread/22544?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 16:40:14 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:b845ebee-81af-4f26-a3df-fc07f2cb8da2</guid><dc:creator>Jeff Bickart</dc:creator><description>&lt;p&gt;That is correct; when you obtain a token you can only be logged in once per platform. You should add a custom platform into your instance of Sugar and then when you obtain the token use your custom platform.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;See the documentation at&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.0/Integration/Web_Services/REST_API/Endpoints/oauth2token_POST/"&gt;support.sugarcrm.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>