How to maintain authentication login in native.newWebView() and system.openURL().

Is it possible to maintain log in to open system.openURL, if you already do in 

native.newWebView ().?

 

I want to download a PDF file from the native.newWebView (), but apparently you can not download. So what I did was capture event.url and open with system.openURL.

 

The trouble is that when you open the browser again asks me to log my count.

 

Any solution.

 

Thanks.

system.openURL() will open the URL in the default web browser on the Device (i.e. Safari on iOS, Chrome on Android). Corona does not pass cookies and data through system.openURL() to the browser. They are different sandboxes.  If you have the URL and you want to download it, why not use network.download()? You can pass your login parameters in using HTTP basic authentication if that’s what your server uses.

Rob

Thank you Rob.

It is a good option network.download() the problem is that after downloading, you can not see the pdf file.

With OpenURL() achievement save the pdf file in the internal or external storage device.

Or is there any way to do that with network.download ()?.

Thanks in advance.

oscarcoronasdk: An iOS-specific approach might be to use the Safari View Controller, which maintains authentication across sessions (and in fact shares cookies, I recall, with Safari).

Hello corona273.

Some example Safari View Controller, which keeps authentication through sessions in IOS, please.

.

.

Some solution for Android devices?

Thanks.

When you use network.download() you can save the file to system.temporaryDirectory or system.cachesDirectory. From there, on iOS you can use the QuickLook plugin on iOS: https://store.coronalabs.com/plugin/quick-look to show it.

On Android, system.openURL() might cause it to load in the Android default PDF display program.

Rob

system.openURL() will open the URL in the default web browser on the Device (i.e. Safari on iOS, Chrome on Android). Corona does not pass cookies and data through system.openURL() to the browser. They are different sandboxes.  If you have the URL and you want to download it, why not use network.download()? You can pass your login parameters in using HTTP basic authentication if that’s what your server uses.

Rob

Thank you Rob.

It is a good option network.download() the problem is that after downloading, you can not see the pdf file.

With OpenURL() achievement save the pdf file in the internal or external storage device.

Or is there any way to do that with network.download ()?.

Thanks in advance.

oscarcoronasdk: An iOS-specific approach might be to use the Safari View Controller, which maintains authentication across sessions (and in fact shares cookies, I recall, with Safari).

Hello corona273.

Some example Safari View Controller, which keeps authentication through sessions in IOS, please.

.

.

Some solution for Android devices?

Thanks.

When you use network.download() you can save the file to system.temporaryDirectory or system.cachesDirectory. From there, on iOS you can use the QuickLook plugin on iOS: https://store.coronalabs.com/plugin/quick-look to show it.

On Android, system.openURL() might cause it to load in the Android default PDF display program.

Rob