Closed carlesserra closed 4 years ago
Is that a hosted web browser control or a native browser window?
It's a native browser IE window.
I'm running the Analytics sheet, included in the VBA-Web-Example.xlsm file, in the Examples folder.
In the Login function, in the GoogleAuthenticator module class, there is a Do While loop (line number 133), which is supposed to wait until the access token is given, but when this happens, I can only close the window. When closed, the loop exits with error.
Set auth_IE = CreateObject("InternetExplorer.Application")
auth_IE.Silent = True
auth_IE.AddressBar = False
auth_IE.Navigate Me.GetLoginUrl
auth_IE.Visible = True
' Wait for login to complete
Do While Not auth_LoginIsComplete(auth_IE)
DoEvents
Loop
OK, I recently had some trouble with Google MFA logins using a different project but I don't think it applies to this. Just in case it does, I had to leverage the registry.
32bit HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
64bit HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
new DWORD (32bit) value of Excel.exe
with value (decimal) 11000
This can affect the emulation mode, more info at
https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330730(v=vs.85)?redirectedfrom=MSDN#browser_emulation
For me the Google login pages were acting oddly until I maxed out the emulation mode, but I was bringing up the pages in a different way so no idea if relevant.
Same behavior :(
I get the same issue as you For bypass this, you need to update the LoginIsApproval ffunction in GoogleAuthenticator
Original code
` Private Function auth_LoginIsApproval(auth_IE As Object) As Boolean Dim auth_UrlParts As Dictionary Set auth_UrlParts = WebHelpers.GetUrlParts(auth_IE.LocationURL)
auth_LoginIsApproval = auth_UrlParts("Path") = "/o/oauth2/approval"
End Function `
Correct code
` Private Function auth_LoginIsApproval(auth_IE As Object) As Boolean Dim auth_UrlParts As Dictionary Set auth_UrlParts = WebHelpers.GetUrlParts(auth_IE.LocationURL)
auth_LoginIsApproval = auth_UrlParts("Path") = "/o/oauth2/approval/v2/approvalnativeapp"
End Function `
For my own it's work - just need to have a sample for the next steps :)
It works!
After this change, however, the authorization code returned by auth_LoginExtractCode was empty.
After inspecting the elements, I realized that the authorization code was in a TEXTAREA element, instead of an INPUT element.
Therefore, I changed the line
If VBA.UCase(auth_Element.NodeName) = "INPUT" Then
by this one:
If VBA.UCase(auth_Element.NodeName) = "TEXTAREA" Then
After that, success.
Thank you very much for your help!
I'm trying VBA-tools to use Google Calendar API but after the user gives permission, the process gets stopped at this window, showing the access token:
Maybe it's an stupid question, but I don't know else to try.