Select to view content in your preferred language

Maps and Apps Gallery - Token keeps timing out every 2 weeks!

1217
6
Jump to solution
04-29-2013 09:51 AM
CarmenDurham
Frequent Contributor
In March of 2012, we had to add a token so that our maps and apps would appear in the Gallery. The token was supposed to be valid for a year and it was.

March 2013, we had to get another token referencing info from this KB Article:
http://support.esri.com/en/knowledgebase/techarticles/detail/40063

When I obtain the token, the top of the page reads "token valid for 365 days".  But it is only lasting 2 weeks.  Every two weeks, we keep seeing "No items were found" and I can see an item in "firebug" indicating that the token is invalid.  I use token helper to get a new token and it works again.  For two weeks.

What is going on??

Thanks,
Carmen
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MikeTschudi
Frequent Contributor
Hi Carmen,

Thank you for bringing this change to the token policy to our attention. In mid-2012 we reworked the Maps and Apps Gallery to generate its token on the fly because the annual token refresh seemed onerous to us, so there is a path out of this problem available now.

The latest version is available from Esri's github site. Help for this conversion is available from Esri Support and the Local Government team.

There are two important changes to the gallery:

  1. The proxy.config file now holds the credentials to the ArcGIS.com gallery

  2. The configuration file has been converted from JSON to JavaScript; this was done so that we could run it through a validator, which is very helpful for catching typographic errors

The gallery also comes with a web page called checklist.html which is useful for testing the various aspects of the configuration outside of the application itself.

For additional discussions about the Local Government apps, please see the Local Government forum.

Mike

View solution in original post

0 Kudos
6 Replies
MikeMinami
Esri Notable Contributor
Where exactly are you seeing the text that the token is valid for 365 days? That is not correct. Can you provide the URL to the page?

The maximum length of a token changed to 2 weeks a while back...

Thanks,

Mike
0 Kudos
CarmenDurham
Frequent Contributor
Mike,

Well, then that leads to another question?  Why in the world did it get changed to every two weeks and is there something that can be done to avoid that?  Please provide any links possible so that I may forward it to the folks here that implemented the maps and apps gallery so that it can be changed. I wasn't involved with the implementation and was only brought in to troubleshoot why the gallery didn't appear (because it seems to only happen when the others aren't available!), so I admit to having a lack of knowledge about the gallery.

Our maps and apps gallery is maintained on a server to which GIS doesn't have direct access.  So, I have to get a token and send it to someone who can access that server to change the config file.  That would be a total pain to have to do every two weeks.

The token helper is where I saw the "one year from today" comment (see image):

[ATTACH=CONFIG]23856[/ATTACH]

Thanks for any information you can provide.

Carmen
0 Kudos
MikeMinami
Esri Notable Contributor
The Token Helper is not correct. Thanks for letting us know. I'll make sure it gets changed so as not to cause any further confusion. At the time that utility was written, the maximum token timeout was a year. But that was changed to 2 weeks a short time later for increased security.

I don't know if there was a specific announcement of the change. You can refer to the documentation on this:

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Generate_Token/02r3000000m5000000/

Here's what it says:

The token expiration time in minutes. The default is 60 minutes.

Example: expiration=60 (1 hour)

The maximum value of the expiration time is controlled by the server. Requests for tokens larger than this time will be rejected. Applications are responsible for renewing expired tokens, expired tokens will be rejected by the server on subsequent requests that use the token.


Probably what you need to do is modify your application code to request a token before displaying your gallery.

Thanks,

Mike
0 Kudos
CarmenDurham
Frequent Contributor
Mike,

Thank you for the information, but we need more!  I am trying to gather information to tell the two people who worked on this what they are going to have to do.  One person is the Web Manager (web designer, not GIS) and the other is a GIS person who is out all week.  Neither are programmers. 

Here is how our site was created per information from the Web Manager:

  • In late 2011/early 2012 the Web Manager received the template files that were downloaded from the Local Govt Site by someone in GIS.

  • She altered only the .css files and the html wrapper but did not alter any javascript because she isn't a programmer.  No one altered the javascript. 

  • The only thing that dealt with the token of any kind is within a "config file" that they received as a part of the download.  They had to alter the gallery Owner, groupid and token in this file.  See the image below for a snapshot of this section of the "config file":

[ATTACH=CONFIG]23876[/ATTACH]

The token part is what we are having to replace every two weeks.  To continue to have to do this is out of the question!

It almost sounds like the template downloaded has totally been reworked since then.  Is this right?  Does the newer template somehow have code to deal with requesting short-lived tokens on the fly that didn't exist with the version we are currently using?  Is their only alternative to download a whole new template and start over, or is there some snippit of code that we can alter in the existing?  Here is our site, if it helps:  http://maps.greenvillesc.gov

I have had to write flex code to work with short-lived tokens on the fly so I understand that concept.  But I never worked with the gallery template and don't know what to tell them as far as the best approach to fix this.  Sorry - I am the one in the middle trying to ask the technical questions!

Thanks,
Carmen
0 Kudos
MikeTschudi
Frequent Contributor
Hi Carmen,

Thank you for bringing this change to the token policy to our attention. In mid-2012 we reworked the Maps and Apps Gallery to generate its token on the fly because the annual token refresh seemed onerous to us, so there is a path out of this problem available now.

The latest version is available from Esri's github site. Help for this conversion is available from Esri Support and the Local Government team.

There are two important changes to the gallery:

  1. The proxy.config file now holds the credentials to the ArcGIS.com gallery

  2. The configuration file has been converted from JSON to JavaScript; this was done so that we could run it through a validator, which is very helpful for catching typographic errors

The gallery also comes with a web page called checklist.html which is useful for testing the various aspects of the configuration outside of the application itself.

For additional discussions about the Local Government apps, please see the Local Government forum.

Mike
0 Kudos
CarmenDurham
Frequent Contributor
Thank you, Mike, for the information and clarification.  I have passed this along to those that will be working on this. 

The annual token wasn't such a big deal, but when the 1 yr ran out in late March and then the tokens were only good for 2 weeks - then it was a problem.

Carmen
0 Kudos