android - Google token life time for GoogleSignInApi -
is possible increate token life time or update token without user interaction?
googlesigninresult result googlesigninaccount acct = result.getsigninaccount(); email = acct.getemail(); idtoken = acct.getidtoken();
gives me token lifetime 1hour. best way force update token?
yes, right now, google issues 1hr long id token. if want use id token identity assertion session management, can use silentsignin (javadoc), doesn't involve user interaction. if old token hasn't expired yet, (cached) version (optionalpendingresult returned have isdone()==true); if expired already, refreshed 1 (but take little longer , optionalpendingresult isdone() false).
also, depending on whether call silentsignin on ui thread or worker thread. if call on worker thread, take @ post blockingconnect() + await() simplifies code lot: silent sign in retrieve token googleapiclient
Comments
Post a Comment