I have a question about working with the network in Delphi

With the help of the REST library (with which I know the surface) I connect to the Google drive api

in OAuth2Authenticator successfully received Access and Refresh token

I am trying to update AccesToken so

procedure TForm1.Button4Click(Sender: TObject); var LToken :string; begin RESTClient1.BaseURL:='https://www.googleapis.com/oauth2/v4/token'; try RESTRequest1.Method := TRESTRequestMethod.rmPOST; RESTRequest1.AddAuthParameter('grant_type', 'refresh_token', TRESTRequestParameterKind.pkURLSEGMENT); RESTRequest1.AddAuthParameter('refresh_token', OAuth2Authenticator1.RefreshToken, TRESTRequestParameterKind.pkURLSEGMENT); RESTRequest1.AddAuthParameter('client_id',OAuth2Authenticator1.ClientID,TRESTRequestParameterKind.pkURLSEGMENT); RESTRequest1.AddAuthParameter('client_secret',OAuth2Authenticator1.ClientSecret,TRESTRequestParameterKind.pkURLSEGMENT); RESTRequest1.Execute; if RESTRequest1.Response.GetSimpleValue('access_token', LToken) then begin ShowMessage(LToken); OAuth2Authenticator1.AccessToken := LToken; end; if RESTRequest1.Response.GetSimpleValue('refresh_token', LToken) then begin OAuth2Authenticator1.RefreshToken := LToken; end; finally RESTClient1.DisposeOf; end; end; 

getting an exception

ETHTTPProtocolException with message 'HTTP / 1.1 404 not found'

Apparently incorrectly composed the request

But the parameters added all those that are listed in the google documentation https://developers.google.com/identity/protocols/OAuth2WebServer (Refresh an access token (offline access))

How to make a request?

0