<?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>Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/3736/refresh-token-becames-invalid</link><description>Hello! I have some technical issue. Please help me resolve my problem. I got refresh token via API. But in some period it becames invalid (less then 24 hours). But when I got it &amp;quot;expiries_refresh&amp;quot; was 1209600. Can you tell me all possible reasons for</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18484?ContentTypeID=1</link><pubDate>Tue, 09 Jan 2018 15:14:27 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:4243d4fa-2f59-43ca-800e-0b7e4582a719</guid><dc:creator>Wendell Nichols</dc:creator><description>&lt;p&gt;P.s.&amp;nbsp; This exact paradigm is what we use with Salesforce and Marketo with reasonable success.&amp;nbsp; No session conflicts etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18483?ContentTypeID=1</link><pubDate>Tue, 09 Jan 2018 15:12:13 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:61b651f3-3861-4863-8d6d-b6da4a140038</guid><dc:creator>Wendell Nichols</dc:creator><description>&lt;p&gt;Lets be clear, I have only one Sugar instance in play here.&amp;nbsp; It is an &amp;quot;on demand&amp;quot; instance provided by SCRM.&amp;nbsp; Let me summarize my problem a little more clearly:&lt;/p&gt;&lt;p&gt;The requirement:&lt;/p&gt;&lt;p&gt;The design time tool must be able to log on to scrm, and obtain a set of tokens for use in the design session and ultimately for the deployed app.&amp;nbsp; It therefore caches a set of tokens for its own use and for applications it creates.&lt;/p&gt;&lt;p&gt;The design time can deploy one or more applications into separate containers in the runtime.&amp;nbsp; Each of these apps will have the set of tokens acquired during design embedded in them.&lt;/p&gt;&lt;p&gt;Each instance of each application can be scaled from 0 to N times.&amp;nbsp; Each scaled instance carries along its tokens and application logic.&lt;/p&gt;&lt;p&gt;So the design time has a set of tokens it uses for fetching schemas etc while building apps.&amp;nbsp; Each instance of each deployed application has a copy of those tokens.&lt;br /&gt;&lt;br /&gt;The problem:&lt;/p&gt;&lt;p&gt;As soon as the original token expires the refresh token is used to get a new token, and at that point all other instances are using invalid tokens and fail.&lt;/p&gt;&lt;p&gt;The documentation suggests that OAUTH keys can be allocated on a &amp;quot;per application&amp;quot; basis and that multiple things, like cell phones, can use them.&amp;nbsp; I just don&amp;#39;t see how.&lt;/p&gt;&lt;p&gt;Your thoughts will be appreciated.&lt;/p&gt;&lt;p&gt;wcn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18482?ContentTypeID=1</link><pubDate>Fri, 05 Jan 2018 19:40:32 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:37a4798d-4898-411e-8b8e-2b4e58aebc7c</guid><dc:creator>Matt Marum</dc:creator><description>&lt;p&gt;You shouldn&amp;#39;t be trying to share refresh tokens between Sugar instances. There would be a refresh token for each instance + user. You don&amp;#39;t need to keep generating Platform IDs, that&amp;#39;s not what I was suggesting. You can&amp;#39;t have multiple clients connecting to same Sugar instance using same platform id at same time or you&amp;#39;ll run into session conflicts. There are ways to mitigate.&lt;/p&gt;&lt;p&gt;If you&amp;#39;d like please reach out to the SugarCRM ISV team, we can setup some time to talk&amp;nbsp;through what you are trying to accomplish.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18481?ContentTypeID=1</link><pubDate>Fri, 05 Jan 2018 15:07:48 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:3586f989-1002-497d-9929-47afbe4e1225</guid><dc:creator>Wendell Nichols</dc:creator><description>&lt;p&gt;These integrations are deployed in an elastic way in the cloud.&amp;nbsp; I find that when more instances are spun up due to load they rapidly start a token war with existing instances because the refresh token&amp;#39;s between instances become different, and only one is valid at a time.&amp;nbsp; This destroys the scalability of the app.&lt;br /&gt;There is no way to allocate separate platform ID&amp;#39;s to each instance because I don&amp;#39;t know how many there are.&amp;nbsp; Each instance is only aware of &amp;quot;itself&amp;quot; and would/should not dynamically adjust its platform ID.&lt;br /&gt;I just can&amp;#39;t imagine how I could create a dynamically scaling microservices implementation which access SCRM Rest interfaces given the OAUTH mechanism it employs.&lt;br /&gt;I have recommended that we stop development of this integration.&lt;/p&gt;&lt;p&gt;wcn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18480?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 17:05:40 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:b7ab63f6-ff56-4e00-83ee-65975cabb590</guid><dc:creator>Matt Marum</dc:creator><description>&lt;p&gt;Hi Wendell,&lt;/p&gt;&lt;p&gt;I&amp;#39;d recommend that each of these microservices use a unique platform ID which would allow each of them to have their own access tokens and refresh tokens.&lt;/p&gt;&lt;p&gt;&lt;a href="https://developer.sugarcrm.com/2016/05/09/platform-parameter-in-sugar-v10-rest-api/" rel="nofollow" target="_blank"&gt;How platform parameter works in Sugar v10 REST API &amp;laquo; Sugar Developer Blog &amp;ndash; SugarCRM&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Obviously, I understand that with scaling you could have any number of&amp;nbsp;microservice instances connecting to Sugar which could make registering platforms problematic. Is it possible that you could deploy a gateway service that manages communication with Sugar from a single point?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18479?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 16:51:22 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:c88ea9c4-71c3-40bb-9575-6de956707631</guid><dc:creator>Wendell Nichols</dc:creator><description>&lt;p&gt;Vladimir, did you get an answer to this?&lt;br /&gt;My experience is that :&lt;br /&gt;-you login to get a set of tokens&lt;br /&gt;-the access token expires after an hour&lt;br /&gt;-you use the refresh_token to get a new access_token, and it sends back a new refresh_token as well&lt;br /&gt;-as of this point the original refresh_token is invalid&lt;br /&gt;&lt;br /&gt;This means that if I have several microservices deployed (or even the same one scaled to 4 instances) the first one of them to refresh the token can continue, and the others fail thereafter.&lt;br /&gt;&lt;br /&gt;This question has been asked here a number of times and never answered to the best of my knowledge&lt;br /&gt;wcn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18478?ContentTypeID=1</link><pubDate>Tue, 28 Feb 2017 15:55:59 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:c1f9a177-62cc-4129-9e0f-521677030415</guid><dc:creator>Vladimir Tykvach</dc:creator><description>&lt;p&gt;Hi Enrico,&lt;span class=""&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The problem is becoming refresh_token Invalid (not expired)&lt;/p&gt;&lt;p&gt;Thanks for you help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18477?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2017 12:41:50 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:f59f7574-6207-4ef9-8116-2de524a9c55f</guid><dc:creator>Enrico Simonetti</dc:creator><description>&lt;p&gt;Vladimir,&lt;/p&gt;&lt;p&gt;The blog post probably only indirectly covers the subject.&lt;/p&gt;&lt;p&gt;You should check:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Do PHP sessions last long enough? If not why? Do you use file system or memcached or redis or what? If memcached, see if evictions can terminate earlier the session?&lt;/li&gt;&lt;li&gt;Do you have any php errors or sugarcrm messages (eg: change of client ip address that terminates the session, or same user logging in from multiple devices)?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;If the PHP sessions lasts long enough (for one reason or another) there should be no reason why the token should expire earlier&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18476?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2017 11:03:56 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:b3494bc1-bc47-451d-8274-3b0dbbc0f73a</guid><dc:creator>Vladimir Tykvach</dc:creator><description>&lt;p&gt;Hi, &lt;span class=""&gt;Enrico,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=""&gt;Thank you. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=""&gt;I&amp;#39;ve already checked&amp;nbsp; refresh_token_timelife (before asking). In this case getting token returns this value, but in my case I&amp;#39;ve got default period (14 days).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=""&gt;Maybe it can be something else?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Refresh token becames Invalid</title><link>https://sugarclub.sugarcrm.com/thread/18475?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 11:05:19 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:55e42d86-8038-48c0-a008-06ab4a73cbd8</guid><dc:creator>Enrico Simonetti</dc:creator><description>&lt;p&gt;Hi Vladimir,&lt;/p&gt;&lt;p&gt;This &lt;a href="http://enricosimonetti.com/how-does-authentication-work-in-sugar-7/" rel="nofollow" target="_blank"&gt;Session duration on Sugar 7&lt;/a&gt;&amp;nbsp;blog post that I wrote a while back should give you a full picture on how it all fits together and most of the client/server side possible causes.&lt;/p&gt;&lt;p&gt;Hope it helps&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>