Comments (21)
Correct, its a basic authentication.
from cordova-plugin-inappbrowser.
Does the prompt work in the normal Android browser?
In other browsers like Firefox for Android?
from cordova-plugin-inappbrowser.
Yes, I have opened the same in android chrome browser its showing prompt to enter the credentials.
The same i opened in firefox its prompt for signIn But i noticed one thing which is a text saying as The site says: "Protect:/"
from cordova-plugin-inappbrowser.
But i noticed one thing which is a text saying as The site says: "Protect:/"
Huh? Can you provide a screenshot?
Seems to me cordova-plugin-inappbrowser
is not configured to prompt for authentication passwords. One reason could be to avoid users entering credentials in a way they don't intent to?
Is this only on Android or also on iOS?
You will have to find out how InAppBrowser creates the webview to display the pages, then see if there is a configuration option for that code to enable or disable the authentication prompts. Maybe this has to be added to this plugin via a Pull Request.
from cordova-plugin-inappbrowser.
Yes in IOS also i have verified its prompting in safari browser, but when i check in app using _blank i see only IOS loader screen not prompting signIn screen.
from cordova-plugin-inappbrowser.
but when i check in app using _blank i see only IOS loader screen not prompting signIn screen.
What does that mean exactly? Can you provide a screenshot?
Are you opening the page with the password prompt directly in InAppBrowser? Try opening a normal HTML page first that is not behind a password, then add a link to the page and click it. Is the behavior different?
from cordova-plugin-inappbrowser.
Above is the screenshot for IOS. Coming to the scenario, I am loading inappbrowser on a click event
function openBrowser() {
showHelp(url);
}
var inAppBrowserRef;
var cookies;
var interval;
function showHelp(url) {
var target = "_blank"; //_blank _self _system
// var options = "location=no,hidden=yes;clearcache=yes;clearsessioncache=yes;";
var options = "location=no,hidden=yes;";
console.log('Opening Inapp browser ');
inAppBrowserRef = cordova.InAppBrowser.open(url, target, options);
inAppBrowserRef.addEventListener('loadstart', loadStartCallBack);
inAppBrowserRef.addEventListener('loadstop', loadStopCallBack);
inAppBrowserRef.addEventListener('loaderror', loadErrorCallBack);
inAppBrowserRef.show();
}
i have opened a normal html which is google.com it is opening properly. i have loaded gmail it is also loaded properly. The only problem is when a server is directly requesting to signIn in order to access for a webpage.
from cordova-plugin-inappbrowser.
Ok. Please create a webpage linking to the protected one and open that in InAppBrowser, then click the link. Test in both iOS and Android.
If that also has the same behavior, the only solution will be to do what I described in the last paragraph of #282 (comment)
By the way:
Do you actually want your users to enter a username/password combination for that URL?
Or do you want to hardcode the credentials in the app and have the page directly accessible?
from cordova-plugin-inappbrowser.
Yes, the page will return few info regarding the loggedIn by specific user and it is not hardcode credentials. I have tried the above mentioned scenario also and it behave the same. But finally i found some info which the pop-up raised because of Windows based authentication which is not a webpage authentication. Please check the below link for sample windows based authentication.
from cordova-plugin-inappbrowser.
No, the popup you are seeing looks like a normal "Basic authentication" - how this works in the backend doesn't matter. You can check the response headers in your browser's dev tools network panel to see if it contains WWW-Authenticate: Basic
from cordova-plugin-inappbrowser.
Ok, good to be sure.
Next thing to try: Do the URLs work if you supply the username and password in the URL: https://username:[email protected]/page
. If that does, it might offer a workaround you could use. But try this first. (Should also work in desktop)
from cordova-plugin-inappbrowser.
I have tried it but results no change, its again redirecting to the login screen and prompts for credentials.
from cordova-plugin-inappbrowser.
Okay, so supplying credentials via the URL is also a no go by default. (Tested iOS and Android?)
Can you maybe move the authentication to a different method, not Basic Auth but a login form?
from cordova-plugin-inappbrowser.
No positive by adding credentials via url. Is there any other approach.
from cordova-plugin-inappbrowser.
No positive by adding credentials via url.
Tested both iOS and Android?
(I need an explicit answer before moving on to the next thing to try - otherwise we might miss a simple solution)
Is there any other approach.
See my previous comment:
Can you maybe move the authentication to a different method, not Basic Auth but a login form?
from cordova-plugin-inappbrowser.
Yes, i have tested in Android and IOS results same error.
I have created a form authentication, its working properly and i can get the required token.
from cordova-plugin-inappbrowser.
Token? Please elaborate.
from cordova-plugin-inappbrowser.
Ok, after some googling:
-
This exists to solve this specific problem: https://github.com/MicrosoftArchive/cordova-plugin-auth-dialog Unfortunately it is not very well maintained and outdated, but there are multiple forks with additional commit like e.g. https://github.com/michael79bxl/cordova-plugin-auth-dialog. Problem: The docs say this does not work in InAppBrowser, but I am not sure this is actually true (I found issues and comments that indicate that it indeed does work on Android, but maybe not on iOS).
-
Another "hack" that could work if there is only 1 page, and no links to other pages on it:
Create a simple website with a form that accepts username and password. When submitting this form, the "proxy" script takes the credentials and requests the correct website with theAuthorization
header directly, and return the HTML of the original page to the InAppBrowser which can then display it. (If there are more links on the page, one could also replace them with a different URL that again uses the "proxy" to get the original page with the credentials, modify the links and return to the browser. -
If you want to work on the InAppBrowser plugin yourself, this might give you some ideas (at least for Android): https://stackoverflow.com/questions/38369522/inapp-browser-basic-authentication-not-working + https://stackoverflow.com/questions/36041760/open-inappbrowser-with-authorization-header
from cordova-plugin-inappbrowser.
On authentication success i will get user information along with user access token.
from cordova-plugin-inappbrowser.
Oh, so the whole point was to get an authentication token via username + password, not load actual content in the InAppBrowser?
from cordova-plugin-inappbrowser.
Perfect.
from cordova-plugin-inappbrowser.
Related Issues (20)
- IllegalArgumentException when closing InAppBrowser on android HOT 1
- Cookie deleted after app closes HOT 1
- Access HTTP response headers HOT 1
- Android FR: Enable zoom without displaying on-screen zoom controls
- Calling window.print() does not work
- Keychain not work with inappbrowser HOT 1
- Disable close button (Done) for iOS
- InAppBrowser does not open Youtube Links Properly HOT 12
- The preference name "MediaPlaybackRequiresUserAction" has been deprecated. It is recommended to replace this preference with "MediaTypesRequiringUserActionForPlayback."
- When can we expect latest 6.0.0 version release on npm? HOT 1
- The www/inappbrowser.css file should be removed because it was only for the Windows platform HOT 1
- Cannot build iOS Ionic Capacitor project HOT 5
- 6.0.0 Update throws error while archiving iOS project: "'Cordova/CDVWebViewProcessPoolFactory.h' file not found" HOT 1
- "browser.on('loaderror')" does not work properly on iOS.
- executeScript not working in colab HOT 4
- How to build this plugin for node_modules? HOT 2
- Add option to respect/ignore safe area on iOS
- ref.executeScript can't write clipboard HOT 5
- window.open doesnt work inside the opened webview HOT 2
- Warning when submitting to play store - JavaScript Interface Injection HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-inappbrowser.