Skip to content

Instantly share code, notes, and snippets.

@orcchg
Created October 21, 2023 17:51
Show Gist options
  • Save orcchg/95c72559147ef98fa4c4fcf3cadee16c to your computer and use it in GitHub Desktop.
Save orcchg/95c72559147ef98fa4c4fcf3cadee16c to your computer and use it in GitHub Desktop.
Check for token existence and expiration
if (accessToken != null && System.currentTimeMillis() < accessToken.createdAt + accessToken.expiresIn) {
return@synchronized accessToken.toString() // access token is valid
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment