How to not follow redirects on Flutter Web - flutter

I can't figure out how to make a POST request that dosen't automatically follow redirects on Flutter Web. I've tried using Flutter's HTTP library, Dart's HTML library, and a third party plugin Dio, and set the followRedirects flag to false on all of them. All of them have automatically followed redirects anyway, and there are cookies that are only contained in one of the redirects that I am trying to obtain. Using a network inspector I am able to see that all of the redirects are followed and the cookie I am looking for is there, but I can't get the response in Flutter. I have also tried dio's cookiejar plugin, but it dosen't seem to cache any cookies for any uri on Web.
Any help would be appreciated, thanks for reading.

Related

How to prevent Auth0 to redirect after logout (ionic app)

I am working on an Ionic 6 app that uses Auth0 for authentication. We are using the embedded login strategy and auth0-js as the client library to talk with auth0.
I've reached to the point where everything works nice if I serve the app on an emulator via ionic serve. I can login and logout effortlessly, and authjs' logout method, which I'm calling as follows:
public logout() {
store.dispatch('endSession');
this.endSession();
this.webAuth.logout({
returnTo: process.env.VUE_APP_LOGOUT_CALLBACK,
clientID: clientId,
});
}
Does redirect me to http://localhost:3000/login as intended (that's the value of VUE_APP_LOGOUT_CALLBACK).
However, when I compile the app and launch it on a mobile phone (I'm using android studio) I have the following problem:
My current problem
After calling WebAuth.logout, the app stops and a browser tab pointing to localhost:3000/login tries to open as if it was a website I'm navigating to. But the behavior I want is for the app to return to the login page, of course.
Other users seem to have found the same issue:
https://community.auth0.com/t/logout-on-ionic-3/20222/9
https://community.auth0.com/t/impossible-to-redirect-user-after-logout-ionic-angular/82205
But no one really solved the issues in those threads. I had no luck finding more resources related to this.
What I've tried
I've tried changing the redirect route to capacitor://localhost/login, hoping it's a way to tell the ionic shell to navigate inside the context of the app, but it didn't work.
I've tried to avoid passing redirectTo as an option to WebAuth.logout(). This makes the method to redirect to the first URL set up on the Auth0 dashboard allowed logout URL, as far as I know.
I've played with a lot of different URL's as returnTo, like / or /login, but it didn't work as I expected and the browser always tries to open such URL as a new website, instead of navigating in the context of the running app.
What would be the ideal outcome
I'd like the app to return to /login, which is the first view the user encounters when they launch the app on the phone.
If that's not possible, maybe it would be possible to just get Auth0 to not redirect at all, so I can perform the redirect by myself and send the user back to the login page.
Maybe there's a way to tell my app not to ever redirect to the redirectUri, even if there's no way for auth0 to avoid trying to redirect the app to another page? Auth0-js docs don't suggest any way to avoid the redirect, but maybe there's a way via ionic config or javascript to make sure the app won't ever redirect to a certain URL.
Thanks for your time!

Assert Request URL is specified URL using Protractor

Does Protractor provide a native way to check requests going out from events such as a button click?
For example, onClick(), a POST request is made to https://myapi.net/customers and I'd like to, during my test, make an assertion on the Request URL.
I've seen some npm packages that might be provide some help, but looking through the Protractor API's, I can't seem to find anything that would handle this out of the box.
Thanks!
One simple way to do is to use browser.driver.getCurrentUrl()
Preceding approach will provide the current url on browser but if you are interested in url which is triggered after click button then i am not aware how we deal this in webdriverJs but in .Net there is Support.Event namespace which provide the way to do action after ElementClicked event.

Debug Facebook Instant Articles in browser

according to this page (https://developers.facebook.com/docs/instant-articles/analytics) on the Facebook Instant Articles documentation is possible to debug them in a browser using the following url:
www.ia-tracker.fbsbx.com/instant_article_test?url=<share-url>
Now I keep getting the following error:
Notice The trackers are run in same environment as Instant Articles,
except that the base url is different. On Instant article, it's the
url, that the user shared.
I tried to use the canonical url, without http, with www but nothing worked.
Have someone been able to use this method successfully, and if yes what they mean by "share url"?
The debug page doesn't actually render your page in the browser, it running the tracking code it finds just like they would be run in the instant article renderer. If you open the source code of the page you will see that there is a tracker code loaded.
The purpose of that page is to test analytics code, not the FIA itself.
Basically you will have the error if you put wrong URL or if you put the URL to the article that doesn't have FIA implemented. That notice that you get is sign of successfully loaded analytics code from the FIA itself.

Facebook and SSL partially encrypted

I got problem when loading Facebook Javascript SDK, it will causing my SSL connection partially encrypted. I try load not using the asychronous one but the result same. Do you have solution for this problem guys?
Thanks
#andriansandi
the code facebook gives to implement the JS SDK uses a protocol relative URL ... The URL of the JS file is //connect.facebook.net/en_US/all.js.
By not specifying http/https the browser will automatically use whichever protocol the page was requested with. Try substituting that with https://connect.facebook.net/en_US/all.js. This will force facebook to load the SDK over https.

security warning in IE9 "Show all content"

I'm implementing the facebook Comments plugin on my site. Users get the warning "Show all content" in IE9
This other publisher using the same plugin and it does not bring up the warning.
Can some please help me with this?
Asking users to turn of the mixed content warning in their IE9 is not an option.
We were just looking at this today and our workaround for now was to include the Facebook Library over https (even when the page itself is viewed over http). Although not ideal it gets rid of the mixed content warnings in IE9 until they have fixed their bug.
That seems to be how it was accomplished at www.vg.no linked in the original question, the library is linked via https.
From their code:
<script src="https://connect.facebook.net/nb_NO/all.js"></script>
I have the same problem:
I have a page that's 100% http. But, the facebook javascript (which I call over http), is returning assets (.js, images) over https, which is generating security warnings for IE(9) users.
I have figured out it's the comment widget from Facebook (
Here's an example of a live page on http: with the error:
http://app.gophoto.com/p?id=10173&rkey=CD01891B287792415384&s=1&a=6940
Here's one of the assets that Facebook returns over HTTPS
https://s-static.ak.facebook.com/rsrc.php/v1/y8/r/7Htnnss1mJY.js
(I'm unable to comment (for some reason?) on Joel's answer. But, his suggestion to fetch the initial all.js over https on http sites does not actually work. I've tried it, and it also inherently looks incorrect since even the initial js fetch violates the mixing up of http & https content.)