AnsweredAssumed Answered

AGSPortal does not call delegate when AGSCredential is expired

Question asked by marius_tabletcommand on Jul 14, 2014
Latest reply on Dec 1, 2014 by DGoyal-esristaff

Hello,

 

Based on https://github.com/Esri/arcgis-runtime-samples-ios/tree/master/OAuth%20Login%20Sample, I've added user authentication to the app I'm working on. I saved the token returned by AGSOAuthLoginViewController to the keychain (same as the sample code). Everything works fine when you're trying to access the ESRI account for the first time. However, after a while, things start to break. I'm testing this using an ArcGIS online account.

 

1) The the AGSOAuthLoginViewController.refreshTokenExpirationInterval is not respected. I've tried setting it to -1, but it expires after a while (a couple of days or so). Maybe the expiration interval is set to that by the portal administrator (as said in the documentation). However, once the token expires, when I initialise AGSPortal with that expired AGSCredential, the portalDidLoad: and portal:didFailToLoadWithError: are not called anymore. The only way to get from this weird situation is to 'manually' delete the saved token from the keychain (using AGSKeychainItemWrapper init ..., [wrapper reset]).

 

2). Setting the AGSOAuthLoginViewController.refreshTokenExpirationInterval to 5 (minutes) does not help either. I've tried a couple of times, and the token is somehow automatically refreshed, with a new expiration date. The only place it could happen (from my findings) is in [[AGSPortal alloc] initWithURL:url credential:expiredToken] or other internal implementation of AGSPortal.

 

With these two things in mind:

- is there a way to force the token into a time-expired state, to test and figure out how to properly implement token refresh, for 1).

- do you have an explanation for 2)? Is it possible that once agsportal is initialised with an expired token, the returned token is a new fresh one?

 

Thank you,

Marius

Outcomes