Can someone help me understand the justification of the security model for refreshing access tokens (non-PKCE)?
- To authorize, a client ID and secret must be provided
- Ok, that makes perfect sense
- Authorize yields a refresh token and an access token
- I suppose the added security of the refresh token is just that it’s used less often than access token. Kind of weak, but fine, ok
- To refresh the access token, the client ID and secret are needed (and refresh and access tokens, too)
- This introduces a security issue on the client side:
The refresh, for most cases, will very likely be done automatically. This means the automation code (e.g. cron job) needs access to the client ID and the secret. This means the client ID and secret must be stored in a cryptographically secured way on the client system, where they otherwise wouldn’t need to be.
This isn’t the case for the initial authorization, since that will likely not be done automatically (because the need for actually, manual authorization from the Square site.)
Furthermore, it raises the question: what’s the point of the refresh token? It can always be obtained with only the client ID and secret, and it’s only useful when used in conjunction with the client ID and secret. It would seem to me, therefore, it adds no additional security. It’s completely superfluous.
Indeed, any information it could possibly refer to, could just be referred to by the access token.
My suggestions: remove the need for the client ID and secret when refreshing tokens. The riskiness of the need to securely store the client ID and secret on virtually every client system far out weighs any perceived added security. The refresh token, one would imagine, is the proxy for the the client ID and secret when refreshing (just as the access token is the proxy when doing everything except refreshing.)
Or explain to me what I’m missing? Sincerely.