PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Settings for Outlook Oauth2
Settings for Outlook Oauth2
Débuté par Simon, 26 sep. 2024 14:32 - Aucune réponse
Posté le 26 septembre 2024 - 14:32
Hi All

Does anyone have working setting for recovinging the auth token from Microsoft so that I can run SMTP to outlook.com accounts. Since Microsoft have applied Oauth2 to outlook.com, I cannot now use emails. Fortunatley the app is still in development, but this is a must.

The code I am currently using is:

OAuthOutlookCnt is OAuth2Parameters
OAuthOutlookCnt.ClientID = "MyClientID"
OAuthOutlookCnt.ClientSecret = "MyClientSecret"
OAuthOutlookCnt.AuthURL="https://login.microsoftonline.com/MytenantID/oauth2/v2.0/authorize"
OAuthOutlookCnt.TokenURL="https://login.microsoftonline.com/MytenantID/oauth2/v2.0/token"
OAuthOutlookCnt.Scope="https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send"
OAuthOutlookCnt.RedirectionURL = "http://localhost:1998" 
OAuthOutlookCnt.ResponseType = oauth2ResponseTypeCode

MyToken = AuthIdentify(OAuthOutlookCnt)
IF MyToken.Valid = False THEN
STC_Failed.Visible = True
ELSE
STC_Success.Visible = True
END

(MyClientID, MyClientSecret and MytenantID are substitued for the actual codes)

I have tried everything but MyToken.Valid always returns False.
I have it working fine with Gmail, but cannot get this to return a token.
Any suggestions would be greatly appreciated before I finish pulling the last of my hair out!

Thanks
Simon