Hi,
So Im getting positive results of Oauth authentication if I manually select an account to use within my browser, but since I do not want to select an account, I need my oauth to utilise the account that Im trying to get access to.
Dim L as String ="theloginemailaddress"
Dim PW as string="thepassword"
' obviously L and PW are normally populated with real info.
Using client As HttpClient = New HttpClient()
Dim request = New FormUrlEncodedContent(New Dictionary(Of String, String) From {
{"grant_type", "password"},
{"client_id", SMTPOAUTH2_CLIENT_ID},
{"client_secret", SMTPOAUTH2_CLIENT_SECRET},
{"username", L},
{"scope", "Mail.Write"},
{"Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{L}:{PW}"))}
})
request.Headers.Add("X-PrettyPrint", "1")
Dim response = client.PostAsync(SMTPOAUTH2_AUTHORENDPOINT, request).Result
jsonResponse = response.Content.ReadAsStringAsync().Result
The json response returned, is an account selection page as I have several Outlook accounts. I figure its probably a parameter I can pass, that bypasses this and goes direct to the account. If anyone knows what the extra parameter is, I would be most grateful, I just cannot find the information I am looking for or may be using the wrong terminology in locating the information.
What I have tried:
as per the above code, I tried adding
{"Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{L}:{PW}"))}
which does not seem to do anything (and is probably wrong anyway) its something I lifted from a web page, but I just cannot get it to go to the account that I need and it may be just a parameter change - Im guessing.