I'm not sure what you are expecting but you can't retrieve the access-token with just one "get".
I see you do the t.AGet() and
directly try to access the html from it.
But OAuth2 doesn't work that way.
If you look closely you'll see that your code runs through the t.AGet() before asking the user for permission.
It shows you an access-page in the browser.
The users needs to allow the access first and
after that the browser is redirected to the redirect_uri.
AFTER that you need to read the URI to extract the code it gives you.
(you can see that after pressing allow you get redirected to localhost with a code in the URL)
You can proceed with that after that.
(This should be the same with Google OAuth2).
The only way to monitor the URL is to open a browser and wait for the browsers-title page to change.
You can see here how I did that with Google OAuth2:
https://github.com/rvk01/google-oauth2Look at TGoogleOAuth2.GetAuthorize_token_interactive in
https://github.com/rvk01/google-oauth2/blob/master/google_oauth2.pas#L474