Skip to content

Google oAuth2 error Bad credentials #23

@BogdanMoisa

Description

@BogdanMoisa

We have had a project for several years that sends emails through a gmail account using a TIdSMTP component.
For authentication, the setting IdSMTP1.AuthType := satDefault was made and as the password an application password set in the gmail account was used.
Now we are trying to do the same thing using oAuth2. I downloaded GMailAuthDemo, things work fine when obtaining a RefreshToken and then when obtaining an AccessToken.
Unfortunately we are unable to get past IdSMTP1.Authenticate. The error "UserName and Password not accepted ..." is returned.
The IdSMTP1.AuthType parameter is set with the value satSASL.
We tried setting the IdSMTP1.Password parameter with either the initial account password, the application password, or the AccessToken but the result is the same.
I ran the project on both Delphi 10.4.2 and Delphi 12.2 but the result is the same.

Can you help us with an idea?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions