I have a requirement to pass the value of token to api.On application loading,we are calling an authentication activity and we are storing the value of token on a page.The value of property in page is being passed to Datapage at requestor level which is readonly page.when datapage is getting stale,it is unable to fetch the value as we have created a datatransform where it is trying to fetch value from same page.The property is not retaining the value in page.What should be the approach and what should be reload strategy for datapage.The token is valid for 12 hrs.
***Updated by moderator: Lochan to update platform capability***
1.In application profile setup, authentication activity is getting called which is calling datapage.
2.After 12 hrs anyways user will have to relogin in order to fetch token as its happening on when user tries to login.
3.Currentlly I was using datatransform in authentication activity which will call datapage and when datapage is stale it will load from temp page.
But now if we can directly store on datapage and apply refresh strategy of 12 hrs.After 12 hrs what logic should we give in load activity as auth activity cannot be called from datapage..user has to relogin.
You can maintain another requestor level data page that holds the parameter required to your data page. If I understood your requirement correctly, all you need to know the param value for the data page which is known during the authentication process only. So you can copy that on to a requestor level data page during authentication process and use that whenever you need it.
Thats correct.we are saving the value in temp page to datapage during authentication activity.The problem happens when the datapage becomes stale before making api call,then it tries to get the value from temp page again which is loosing the value.If we maintain another datapage for just holding the value,what would be refresh strategy for this page?The token remains valid for 12 hrs.so if we give it for 12 hrs would it work or is there a possibility of loosing the value?
You should not depend on the auto refresh strategy of the data page, instead you should refresh it on your own. During authentication process, load the requestor level DP with the token value and expiration time. This data page won't be expired till you explicitly do it. You can rely on the token value present on the data page as long as the expiration time is not in past before using the token. When you find it is expired, you should find a way to refresh the token.
For your case, you should expire the DP with your own logic. You don't have to use OOTB reload strategy. Create the data page ,D_TokenInfo (Requestor level editable page hence no expiry, dummy load data transform) to hold the token and its expiration time (this is basically the DP loading timestamp + 12 hours). This page will be set with the token info during the authentication process. Whenever you want it, use another data page like D_FetchAccessToken which reads the token from the data page D_TokenInfo. If the expiration time is in past which means the token is expired, the loading logic of D_FetchAccessToken DP should get the latest AccessToken and place it on D_TokenInfo. This way it will be reused when its valid.
You need different ways of loading D_TokenInfo. One is during the initial authentication process and other one is during expiration. Hope this is helpful.