• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to store refresh token safely on Android Mobile

Jiten Shah

Lurker
Jun 20, 2017
3
1
I need to use a REST API for accessing data. The REST API uses username and password for the initial authentication and then generates access token and refresh token which are forwarded to the Android client. Refresh token is used so that the user does not have to login everyday and it can be used to renew access token (short-lived) periodically.

My only concern is : if the phone is rooted and gets access to refresh token either from shared preferences or sql db --> the user can keep on generating the access token with help of refresh token and attack the server.

Is there a better way I can handle this situation ? I don't want user to login in every time he opens the app.
 
Difficult to stop. I would implement something on the server side to detect repeated or excessive uses of the token, and take measures to deny service to the sender.

Thank you LV426. So, I can go with my approach of storing access token and refresh token on Android mobile and also implement the Server side intelligence to detect repeated or excessive use ?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones