I am doing an oAuth with a third party service. I am currently opening an inapp browser, and when I complete the auth I want to close the view. What code do I put in the redirect_url html to close the browser and return to the app?
I am doing an oAuth with a third party service. I am currently opening an inapp browser, and when I complete the auth I want to close the view. What code do I put in the redirect_url html to close the browser and return to the app?
Hi Dave,
Here is an example of such code:
pre
//Open inApp browser.
var ref = window.open(url, '_blank', 'location=no');
//Make some delay:
var onDelay = function(){
//Close inApp browser.
ref.close();
};
window.setTimeout(onDelay, 10000);
/pre
Regards.
Thanks -- I see how that might work in the page that launches the inapp browser.
i have a redirect.php url for my oAuth and I want it to execute
If (oAuth fail) then error message
if (oAuth success) then close this inapp browser
That would require code in the redirect.php, not in the page that launches the inapp. Any idea how to do that?
Hello,
Please provide detailed app workflow in steps.
I have the same issue. It is basically opening a 3rd party payment gateway that then redirects to a payment successful page. This window needs to be closed to return back to the App.
You cannot do a window.close(); from the window itself. It has to come from the app. From what I could see you need to use the eventlistner. Not sure if this should be server side or clientside though?
Does anyone got a solution to this?
Thx
Hi Deon,
Please specify details about your implementation.
Where you load 3rd party site?
You need to use inApp browser for this goal.
In this case you can open site with code(from app context):
pre
var win = window.open("http://google.com/", "_blank");
/pre
And close it with code:
pre
win.close()
/pre
You can test it WEINRE debugger to see that window opens and then closes with give code.
Regards.
This cant be done. It is browser security.
Scripts cannot close a window if it was not opened by the script.
Simply putting window.close does not work anymore as the Browser Vendors dont allow this anymore due to security reasons.
So in essence app developers are screwed and cannot return to app unless......
the window opened does NOT open a target other than _self and the script that opened the window is still active to close the window, which normally is not the case because you would not normally run a scriptt to open a window just to shut it again.
So I payed with the html component as I have have my app controls wrapped around the inappbrowser. This solution works perfectly, except when the browser session opens another window as _blank. When this happens, the browser breaks out of the app never to return.
As long as the target is _self all is good.
Hello Deon,
That you for clarification.
Can support be of further assistance here?
Nope. Sadly we can closed this as unresolved.
Hi Deon,
I see you have tried in the past to do something I need to do - just wondering if you found a way?
I don't want to use the appery.io/view/XX_project_ID__XXX/ method to return from an external webapp, such as facebook auth.
Is there any way to set up my own server-side page that returns to a specific page in the app and closes the browser - and passes the facebook token back to the app?
Using the appery url makes no sense for an app once packaged - especially if not continuing to use appery..
Any help really appreciated..
Thanks!
Matt