

emileverh
Members-
Content Count
103 -
Joined
-
Last visited
-
Days Won
2
emileverh last won the day on March 23 2023
emileverh had the most liked content!
Community Reputation
28 ExcellentTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Error F2084: Internal Error: L878 in Delphi 13
emileverh replied to emileverh's topic in RTL and Delphi Object Pascal
Yes, seems to work! -
var connectionstatus : DWORD; Result := InternetGetConnectedState( @connectionstatus, 0); ( Google InternetGetConnectedState to get all the info. Result is a boolean in this case )
-
System.Types error in Delphi 13
emileverh replied to emileverh's topic in RTL and Delphi Object Pascal
I used the USES cleaner from CNPACK and know its gone. I still believe it was a glitch somewhere in D13. But anyhow, until now it's good! -
System.Types error in Delphi 13
emileverh replied to emileverh's topic in RTL and Delphi Object Pascal
No! -
Hi! I have an error: F2051 Unit System.Types was compiled with a different version of System.TArray`1 at line 6 (6:17) see screenshot. I tried cleaning the project from the project window. Tried cleaning my .dcu's in the Explorer. Where does come from?!?! I never touched system.types and it is included once in this project and even not in this unit. PLEASE HELP!
-
NameOf() in D13 to get the name of the current method
emileverh replied to emileverh's topic in RTL and Delphi Object Pascal
Exactly that is what I hope/hoped for -
Error F2084: Internal Error: L878 in Delphi 13
emileverh posted a topic in RTL and Delphi Object Pascal
Hi guys! Last days I get a lot of "Error F2084: Internal Error: L878" errors in Delphi 13. Anyone has seen that also and a solution? -Emile -
I had the same problem, search did not react on keys Alt+Shif+s. By a restart of my PC I saw in a flash a screen with LSP exception and disappeared ...... After PC restart it worked again. (Talking about 32-bit btw)
-
NameOf() in D13 to get the name of the current method
emileverh posted a topic in RTL and Delphi Object Pascal
Hi guys! I want to use in Delphi 13 the NameOf() function to get the current function name ( "UploadCardParseResult" in example below). Is that possible?! procedure TdtmPeppolInvoices.UploadCardParseResult(const AJsonString: string; const AHxr: THXR); begin ShowMessage( NameOf(????) ); -
Google OAuth2, "username and password not accepted" when sending
emileverh replied to emileverh's topic in Network, Cloud and Web
"...Indy recently got a few new OAuth components...." In Delphi 12.2? -
Google OAuth2, "username and password not accepted" when sending
emileverh replied to emileverh's topic in Network, Cloud and Web
Yes scope is correct. Else I did not get the final approval. @Remy Lebeau You as a specialist. Do you know if we can get it working via other components such as TNetHTTPClient? So not for the full scope but for the send-only scope. If you have any good tips for Indy, that is of course also welcome! ( https://www.googleapis.com/auth/gmail.send ) -
Google OAuth2, "username and password not accepted" when sending
emileverh replied to emileverh's topic in Network, Cloud and Web
CASA Tier 2.... I don't have a clue what that is. And I think also off topic. Yes, as I wrote, I am verified owner. I did 1000 times go to screen consent screen again. QUESTION.... ANYBODY: Is there a other way by not using the Indy components. Because gathering the tokens I tried today with a different component from DevExpress ( TdxGoogleAPIOauth2AuthorizationAgent). But I am stuck with 'IdSTMP.Authenticate' as you can see in the first post. In other words is there a working example for TNetHTTPClient?!?!? -
Google OAuth2, "username and password not accepted" when sending
emileverh replied to emileverh's topic in Network, Cloud and Web
procedure TdtmOAuth.DataModuleCreate(Sender: TObject); begin var inifilename: string := ChangeFileExt(ParamStr(0), '.ini'); FIniSettings := TIniFile.Create(inifilename); FOAuth2 := TEnhancedOAuth2Authenticator.Create(nil); IdHTTPServer.Active := True; end; procedure TdtmOAuth.DataModuleDestroy(Sender: TObject); begin FreeAndNil(FOAuth2); end; procedure TdtmOAuth.DoLog(const msg: String); begin CodeSite.Send(msg); end; function TdtmOAuth.HasRefreshToken: Boolean; begin Result := not FOAuth2.RefreshToken.IsEmpty; end; procedure TdtmOAuth.IdConnectionReceive(ASender: TIdConnectionIntercept; var ABuffer: TIdBytes); begin DoLog('R:' + TEncoding.ASCII.GetString(ABuffer)); end; procedure TdtmOAuth.IdConnectionSend(ASender: TIdConnectionIntercept; var ABuffer: TIdBytes); begin DoLog('S:' + TEncoding.ASCII.GetString(ABuffer)); end; procedure TdtmOAuth.IdHTTPServerCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); var code: string; begin if ARequestInfo.QueryParams = '' then Exit; var url: TURI := TURI.Create('https://localhost/?' + ARequestInfo.QueryParams); try code := url.ParameterByName['code']; except Exit; end; FOAuth2.AuthCode := code; FOAuth2.ChangeAuthCodeToAccesToken; // AResponseInfo.ContentText := '<html><body onload="setTimeout(window.close(), 5000);"><h1>PERIFACT: U kunt de browser nu sluiten en terugkeren naar het programma/ You can close the browser and return to the program</h1></body></html>'; AResponseInfo.ContentText := '<html><body><h1>PERIFACT: U kunt de browser nu sluiten en terugkeren naar het programma/ You can close the browser and return to the program</h1></body></html>'; var tokennamestr: string := Provider.AuthName + 'Token'; FIniSettings.WriteString('Authentication', tokennamestr, FOAuth2.RefreshToken); DoLog('Authenticated via OAUTH2'); DoLog(FOAuth2.RefreshToken); SetupAuthenticator; end; function TdtmOAuth.IsAuthenticated: Boolean; begin Result := FIsAuthenticated; end; procedure TdtmOAuth.AuthenticateInBrowser; begin var uri: TURI := TURI.Create(FOAuth2.AuthorizationRequestURI); ShellExecute(0, 'open', PChar(uri.ToString), nil, nil, 0); end; procedure TdtmOAuth.ClearAuthentication; begin // Delete persistent Refresh_token. Note // - This probably should have a logout function called on it // - The token should be stored in an encrypted way ... but this is just a demo. FIniSettings.DeleteKey('Authentication', Provider.TokenName); SetupAuthenticator; end; procedure TdtmOAuth.SendMessage; var IdMessage: TIdMessage; xoauthSASL: TIdSASLListEntry; begin // if we only have refresh_token or access token has expired // request new access_token to use with request FOAuth2.ClientID := Provider.ClientID; FOAuth2.ClientSecret := Provider.ClientSecret; FOAuth2.RefreshAccessTokenIfRequired; DoLog('refresh_token=' + FOAuth2.RefreshToken); DoLog('access_token=' + FOAuth2.AccessToken); if FOAuth2.AccessToken.Length = 0 then begin DoLog('Failed to authenticate properly'); Exit; end; IdSMTP.Host := Provider.SmtpHost; IdSMTP.UseTLS := Provider.TLS; IdSMTP.Port := Provider.SmtpPort; xoauthSASL := IdSMTP.SASLMechanisms.Add; xoauthSASL.SASL := Provider.AuthenticationType.Create(nil); TIdSASLOAuthBase(xoauthSASL.SASL).Token := FOAuth2.AccessToken; TIdSASLOAuthBase(xoauthSASL.SASL).User := Provider.ClientAccount; IdSSLIOHandlerSocketSMTP.SSLOptions.SSLVersions := [sslvTLSv1_2]; IdSMTP.Connect; IdSMTP.AuthType := satSASL; IdSMTP.Authenticate; // <<<<<<<<<<<< HERE IT FAILS!!! <<<<<<<<<<<<<<<<<<<<<<<<<<<<< IdMessage := TIdMessage.Create(Self); IdMessage.From.Address := Provider.ClientAccount; IdMessage.From.Name := CLIENTNAME; IdMessage.ReplyTo.EMailAddresses := IdMessage.From.Address; IdMessage.Recipients.Add.Text := CLIENTSENDTOADDRESS; IdMessage.Subject := 'Hello World'; IdMessage.Body.Text := 'Hello Body'; IdSMTP.Send(IdMessage); IdSMTP.Disconnect; ShowMessage('Message Sent'); end; -
Google OAuth2, "username and password not accepted" when sending
emileverh posted a topic in Network, Cloud and Web
Hi team! I have download the great github example from Geoffrey Smith https://github.com/geoffsmith82/GmailAuthSMTP/. So in short, I want to send (and send only) for clients who have a Google account And it worked fine. So I went to the verification approval process of Google and I passed 😉 I asked for the scope in Google Console: https://www.googleapis.com/auth/gmail.send because I want to send (and sending only) PDF's from my application (I have an invoicing app). But after the approval I get the error message "username and password not accepted". I looked at StackOverflow, Google, Deepseek, etc. to find an answer. I am spending already lots of time in this.... Anyone an idea? -
Nope! Still no result. After Googling I found a link on this forum. And I think the only option is to create a temp table ;-((. https://en.delphipraxis.net/topic/9099-sqlite-varchar-field-overflow/