cordova-plugin-inappbrowser
cordova-plugin-inappbrowser copied to clipboard
adding support for passing request headers
In the #115 pull request, @sanketmehta7 proposed this feature but only for android and his pull request is blocked and not mergeable.
I am needing this support for one of my application both in android and ios.
One other point : @sanketmehta7 propose to encode headers in one unique string with the same encoding than the options argument : header1=value1,header2=value2. but in this encoding values cannot include commas or equals characters.
an other solution is needed to included any characters from headers.
Sounds like a useful feature. We are always open for reviewing new Pull Requests!
But is dead this issue?
Thanks iharyan and lihuelg. You code changes help me in Android and worked fine. I am not sure why in iOS its still not working.
Here is my scenario.
I have 3 urls: entryURL basic Authentication validation URL successURL
- entry url environment.samlURL - example say: site1.com/mobile/index.html (samlURL) - I am passing authorization header
let authHeader:any={};
authHeader['Authorization'] = 'Basic ' + btoa(params.name + ':' + params.password);
const browser = this.iab.create(environment.samlURL, '_blank', { usewkwebview: 'yes', hidenavigationbuttons: 'yes', hideurlbar: 'no', location: 'yes', clearcache: 'yes', clearsessioncache: 'yes' }, authHeader); //passing authHeader to site1.com
-
site1.com redirects with headers to samlSite for verifying authentication (idp-xxx.sss.com/samlverification...)
-
on successful authentication samlsite redirects back to site1.com/mobile/success.html?successToken with successToken
await browser.on('loadstart').subscribe(async (event) => { await browser.executeScript({ code: 'location.search.substring(1)' }).then(async (queryParams: any) => { if (queryParams && queryParams[0] !== '') { const urlParams = new URLSearchParams(queryParams[0]); const sToken = urlParams.get('successToken'); if (sToken ) { resolve(sToken); browser.close(); } } });
In android all works as expected, but in iOS navigation stops in second stage. I am able to see the headers getting passed to site1.com but redirection to idp basic authentication fails.. Is there anything in iOS code where redirection to different domain will stop??
any pointers will be very helpful.
i don't understand why this feature is not yet merged ... it's basic and simple feature.
I cant find any solutions for this case in web. Im searching 3 days any solutions for this case, to add Authorization position in header request and nothing was found. I´ve put some code in my backend that I don't rejoice, passing the Authorization on query param in url and the backend get the Authorization in the query params into the header.
any update on this? Is this feature now added ?
Can anyone take a look at the #1024 ? Different approach, using already present options, implementing headers and cookies. Cheers!