VBA-tools / VBA-Web

VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web
http://vba-tools.github.io/VBA-Web/
MIT License
2.01k stars 494 forks source link

Google authenticator was not working, found fix #290

Open agroberman opened 7 years ago

agroberman commented 7 years ago

Hi,

When trying to authenticate with google, I kept getting the message to copy a code from the IE window, and then the VBA would crash. I've isolated the problem and the fix is to one of the functions:

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

The last line was what I changed, specifically "/o/oauth2/approval/v2/approvalnativeapp" was what fixed it.

Hope this helps someone and sorry if I was unclear, just wanted to get the info out there!

-Alex

swain1500 commented 7 years ago

Hey Alex - Thank you for posting this. I had been experiencing the same thing since late last week. With your fix, I have now gotten past the screen requesting that I copy code from the IE Window, but I am now getting an 'Invalid Request URI' returned to me. Any insights?

Thanks - Marcy

agroberman commented 7 years ago

Hi Marcy,

I'm afraid everything worked fine for me once I applied the fix, perhaps a separate coincidental issue?

I basically stepped through all the executed code to see where the "copy the code" problem came from, it might be necessary for you to do the same on the invalid URI problem.

Take care!

-Alex

On May 3, 2017 10:21, "swain1500" notifications@github.com wrote:

Hey Alex - Thank you for posting this. I had been experiencing the same thing since late last week. With your fix, I have now gotten past the screen requesting that I copy code from the IE Window, but I am now getting an 'Invalid Request URI' returned to me. Any insights?

Thanks - Marcy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/VBA-tools/VBA-Web/issues/290#issuecomment-298961708, or mute the thread https://github.com/notifications/unsubscribe-auth/Aa7ZiY-PE-ce6CnhoZSmR3Mafme9APEtks5r2Kl-gaJpZM4NMtag .

KlausHB commented 7 years ago

Hi,

I have the same problem. After making the changes agroberman recommended, I still get the popup with the code to copy.

Are there additional changes to be made? Like getting the code from an inputbox and send the string back to google?

KlausHB

AdrianWR commented 7 years ago

Thank you very much agroberman, I was stacked with this issue for a couple of hours in this week, loosing my head just to realize that the authentication URL has been updated. By the way, I suspect that the function auth_LoginExtractCode() may be debugged and maybe the "INPUT" string should be modified for the conditional test. Good luck for you guys!

KlausHB commented 7 years ago

@AdrianWR How exactly did You solve the problem? As I wrote, I changed the line agroberman showed above but IE is still giving me a popup with code to copy into my App.

Could anyone give me a little hint?

Thank You

KlausHB

AdrianWR commented 7 years ago

@KlausHB

First, you need to be sure that your auth_LoginIsApproval() function is returning True even if you've changed the URL path as described above, stopping your execution at the function level and verifying the variable's value. If not, check the web_Parts("Path") value in the Public Function GetUrlParts(), at the WebHelpers module, while you run your authorization code.

Despite these possible issues, you should check if the For Loop in auth_LoginExtractCode is executed. In this situation, you'll need to verify each auth_Element.NodeName in the IE webpage to get the authorization. Let's pray this won't happen, after all the pain ;)

KlausHB commented 7 years ago

Thanx, I will try that at the weekend and let You know if I could solve the issue.

Klaus HB

Am 06.06.2017 um 22:52 schrieb Adrian W. Roque notifications@github.com:

@KlausHB https://github.com/klaushb First, you need to be sure that your auth_LoginIsApproval() function is returning True even if you've changed the URL path as described above, stopping your execution at the function level and verifying the variable's value. If not, check the web_Parts("Path") value in the Public Function GetUrlParts(), at the WebHelpers module, while you run your authorization code.

Despite these possible issues, you should check if the For Loop in auth_LoginExtractCode is executed. In this situation, you'll need to verify each auth_Element.NodeName in the IE webpage to get the authorization. Let's pray this won't happen, after all the pain ;)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/VBA-tools/VBA-Web/issues/290#issuecomment-306613477, or mute the thread https://github.com/notifications/unsubscribe-auth/AKPtMY0hQQIoruhXiS8usFfEjeA52tKEks5sBbwGgaJpZM4NMtag.