I am hoping to get some advice regarding my authentication workflow. I feel that I may be overthinking things. Maybe there is a different approach that would be better suited for this application.
I am building an app in React Native using expo (iOS & Android) with the following requirements: The app must implement a persistent login - user only has to authenticate from same device once. (Only under rare circumstances require new login.) App must utilize silent token refresh and refresh token rotation. (Refresh tokens are 1 time use, and exchanged for new upon renewing access token)
I am struggling with deciding how to handle renewing the refresh token dynamically, as traditionally an expired refresh token would warrant the user to re-authenticate. Obviously I’m trading some security for convenience here. Although, I see many other apps that operate this way, but I’m not clear on how they’re handling it, or what the best recommended practices are..
My first thought is I need a way to verify the request to renew the refresh token is coming from a trusted device. I was planning on providing a token binding proof using a unique client identifier upon renewing the refresh token so the request is effectively signed by the client. To accomplish this I was going to exchange asymmetric keys between the client and server, one being used by the client to sign binding, the other would be stored in the database to decrypt & verify the fingerprint prior to renewal.
Does this make any sense here or am I way off the mark? I’m new to this and ChatGPT generally tends to agree with all my ideas lol.. so I just wanted to get a fresh perspective. Is there a better or maybe even a simpler way to do this? I would generally prefer to avoid paid services such as Auth0 if possible.
I have not yet implemented this. Requesting advice prior to implementation.