Hello,
I am using a TAdvGDrive componenent with ExternalBrowser set to True.
When my application is run for the first time, and before it has been authenticated with Google, and the following code is executed, "acc" is immediately returned as false, before the external browser ever has time to be displayed. How do I get the ".Connect" to wait for a user to either allow or deny permission from within the external browser before ".Connect" returns false?
acc := AdvGDrive.Connect;
Is there a downside to using ExternalBrowser? I can find nothing in the documentation or on these forums explaining how/why/or when "ExternalBrowser" should be set to true or false.
Thanks,
Mike
Hi,
Does the issue also occur when ExternalBrowser is set to false?
The problem does not occur when ExternalBrowser is false. However when ExternalBrowser is false, the authorization form is displayed as a blank white page with nothing on it. This causes the application to freeze. It happens under a Server 2008 Remote Desktop session. By setting ExternalBrowser to true, the default browser appears (Chrome), but the ".Connect" immediately returns "false", before the user can click "Allow" or "Deny", and in fact before the browser page has time to open.
Here is the code I'm using.
ShowMessage('a');
AdvGDrive.ExternalBrowser := True;
acc := AdvGDrive.Connect;
ShowMessage('b');
If it matters, tokens are persisted to an ini file (plIniFile).
Here is what happens:
1) The first ShowMessage fires.
2) Then the ".Connect" is called.
3) Within a second or two, the second ShowMessage fires - before the browser page is displayed, so there is no way a user can either allow or deny access - "acc" will always be false.
Again, this is on the first authorization attempt, before the .ini file exists.
I don't see how to attach files to this message (is it possible?), so here are the contents of the LOG file:
20170119T105944:HTTPS GET: https://www.googleapis.com/drive/v2/about/?access_token=
20170119T105946:HTTPS GET RESULT:{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
20170119T105946:HTTPS GET: https://www.googleapis.com/drive/v2/about/?access_token=
20170119T105946:HTTPS GET RESULT:{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Also, when ExternalBrowser is False, this is the blank white window that is displayed when the ".Connect"is issued...
Tried to insert an image to illustrated the blank authorization form, but nothing is showing up.
I have retested this here with our demo for TAdvGMail and both with ExternalBrowser = true or false, I could not see an issue. When ExternalBrowser = true, it shows the default browser (Chrome here) and shows the Google login screen (it instructs the default browser to navigate to this page) This external browser is launched and there is no blocking code in the .Connect method that waits for the authentication & authorization to complete. When authentication & authorization is successful, the event AdvGMail.OnConnected is triggered.
The same applies to the case when ExternalBrowser = false, except that here a dialog is shown with the embedded IE webbbrowser which navigates to the Google login page. If you experience an issue with this, please first look if you effectively use the latest version of the components.