Not familar with Dephi, so I and most people in this forum don't actually know how to translate the AccessToken method. For more professional reponse, you could go the dedeicated Dephi forum.
In any case there's no way to translate, I think below approach would work.