Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authentication with Swift using Joss

I created an Account (joss.model.Account) , in the configuration

allowReauthenticate=true

Almost immidiateley after account creation I call

Access mAccess = mAccount.authenticate(); // (joss.model.Access)

After that I need to use the token. I use it after 30 min and 1.5h and 24h etc. by calling mAccess.getToken() Token expatriation time is 1h. Can I suppose that re-authentication will be performed and after 1.5h as well after 24 h the token will be valid? Or I need to re-authenticate manually?

I.e. mAccess.getToken() will return invalid (expired token) after 1.5h and 24h. How to re-authenticate correctly in this case?

like image 344
Yakov Avatar asked May 09 '16 20:05

Yakov


1 Answers

Just call mAccount.authenticate() once mAccess.getToken() returns invalid. Forget about time in the client app, it must be re-entrant.

Handle UI around that (re-enter username/password if needed before authenticate() method if existing credentials prove to be useless).

like image 193
igraczech Avatar answered Oct 17 '22 21:10

igraczech