I'd like to know if there is any strategy for managing secret expiration in mobile devices.
In a scenario where an authorization server allows a mobile client to authorize against him using a resource owner password flow in combination with client credentials, with the client secrets having an expiration time.
I've seen there are ways to safely store secrets on Android apps at least, but, how do you manage the secret expiration without publishing a new version of the app?
This is how we have done in our App following OAuth Refresh Token Standards.
Step 1: Your API should be sending a standard Auth Token Response as stated here
Step 2: Save that response in Shared Preferences/Local Cache/Local Database, we used Shared Preferences (assuming
accountTokenis Object of class created from Response of Auth Token)Step 3: Each time you have to use saved Access Token, make sure it is not expired
If
needsTokenRefresh()returnsfalsethen use the saved Auth Token. If it returnstruethen go to next step.Step 4: Make Auth call again with
grant_typeset asrefresh_tokenas stated in standardsStep 5: Auth call should return Standard Auth Response as described in Step 1 with token refreshed and new
refresh_token