I posted a link in your other thread - read up on how OAUTH works. The returned token also contains its expiration time (e.g. 3600 seconds), and you have a refresh token, which you can use to request a new access token after expiry.
Someone more knowledgeable should comment on how the script key mechanism works. There might be such an optimization as you mention.