IdentityServer4 - redirects in Chrome stopped working - google-chrome

I have an implementation of IdentityServer (v3.1.4 nugets) running in ASP.Net Core 3.1. On my dev machine (windows 10), Chrome will not redirect back to my Angular site after successful authentication, ie:
var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false).ConfigureAwait(false);
if (result.Succeeded)
{
_logger.LogInformation("User logged in.");
return RedirectToLocal(returnUrl);
}
...
If just ends up back at the login prompt.
Chrome Incognito also fails.
Clearing Chrome cache didn't help.
Rebooted a few times too.
Using FireFox works fine.
Also works fine in test and prod environments (Ubuntu host).
Also works on another dev's machine.
This has been working fine all year. This started after a windows update last week. There was no code change to this part of the front end app or identity server for months.
returnUrl is like:
/connect/authorize/callback?response_type=id_token%20token&client_id=xxxxx.client.js&state=dXF2ZkFpRVFMTjNOY2JPcGxfVVJ3c1VqbXpleDVvU0xrNGRWZ1I1Uzzzzzz&redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Fauthenticate&scope=profile%20openid%20xxxxx.api.v1%20yyyyy.api.v1&nonce=dXF2ZkFpRVFMTjNOY2JPcGxfVVJ3c1VqbXpleDVvU0xrNGRWZ1I1UEpVQ3NH
I guess this is more of an annoyance than a shop stopper but it's convinced me to use Firefox for my main browser now - final straw for Chrome - it's is the new IE.

Problem resolved. Chrome has been warning me about SameSite cookies for so long I had ignored them. Finally, it got sick of me ignoring it. :)

Related

Google login fails with HTTP error 400 saying "Sorry, something went wrong there. Try again."

Description/background
I had set up a script which opened a Google site of our company in Google Chrome (not headless) and did some automated work on that page. The login information had to be refreshed occasionally what for I manually logged in. That had been working perfectly the last couple of months until last week. Today I noticed that I get the above mentioned error message as a result of a server response with HTTP status 400 upon entering my Gmail address and clicking the Next button.
Steps to reproduce
Puppeteer version: 2.0.0
Platform / OS version: Windows 10
URLs (if applicable): https://sites.google.com/...
Node.js version: v12.13.0
What steps will reproduce the problem?
Run a Puppeteer script to open a Google Site which requires login.
(async () => {
try {
const browser = await puppeteer.launch({headless: false, userDataDir: "<ProfileDirectory>"});
const pageLogin = await browser.newPage();
await pageLogin.goto('https://sites.google.com/...', {waitUntil: 'networkidle2'});
...
await browser.close();
}
catch (error) {
console.log(error.stacktrace);
}
})();
Manually enter Gmail address and click Next.
Get error message "Sorry, something went wrong there. Try again." as a result of a server response with HTTP status code 400.
Update:
Manually opening Chrome (same userDataDir) and the respective Google site still works as usual.
Recommend to use playwright/puppeteer + Firefox. It seems like google adds something into chrome so they can detect the browser is automated or not
One of the comments on this post mentions that Google tries to block logins with Puppeteer, Selenium etc. this might be why you are getting a 400 error.
One of the recent comments on the aforementioned post, links a gist with some example code that might still work, haven't tried it though.
While I was doing research on Puppeteer for Firefox, I noticed that (1) Puppeteer downloads its own local Google Chrome binaries it is executing and (2) my installed Puppeteer version 2.0.0 was outdated. Meaning, the browser actually used by Puppeteer was probably also outdated. The solution was as easy as to update Puppeteer to the latest version 2.1.1.

Permission issue for appium chrome borwser

I am implementing an appium test on remote android driver, with chrome browser for loading urls.
Some of the Urls are pdfs, and chrome asks to store those files. and appears that chrome doesnt have access to filesystem to store those files, which results in a dialog like below.
Please help me pass that dialog without any manual inputs.
Upon clicking continue, it will load actual permissions dialog from Android.
Here is my code initialize appium capabilities
DesiredCapabilities caps = DesiredCapabilities.android();
caps.setCapability("appiumVersion", "1.9.1");
caps.setCapability("deviceName","Samsung Galaxy S9 Plus HD GoogleAPI Emulator");
caps.setCapability("deviceOrientation", "portrait");
caps.setCapability("browserName", "Chrome");
caps.setCapability("platformVersion", "8.1");
caps.setCapability("platformName","Android");
caps.setCapability("autoAcceptAlerts", true);
caps.setCapability("autoGrantPermissions", true);
caps.setCapability("chromedriverArgs", "--allow-file-access-from-files");
caps.setCapability("maxDuration", 10000);
and this is the snippet I use to load a Url
driver.navigate().to("http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");
autoGrantPermission also doesnt work in this case because chrome is already installed. Appium team has already rejected this issue -
https://github.com/appium/appium/issues/10008
Please help!
Indeed I had very hard time finding out the solution, but eventually I found a workaround.
The best workaround would have been reinstalling the chrome package. I tried that, but I could not start chrome after reinstalling it, as I had no access to shell, and chromedriver complained. So I left that track.
I tried getting hold of adb command or mobile:changePermissions but for that you need to use server flag --relaxed-security while starting the server, and saucelabs doesnt provide any handy interface to start the server with this flag.
The last resort, I found a solution here - https://stackoverflow.com/a/51241899/4675277 . But just that was not sufficient, because it helped me fix chrome alert, but later on it popped up with another alert with allow and deny, for which another solution in the same question helped me. So this is the code I eventually used -
driver.navigate().to("http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");
String webContext = ((AndroidDriver)driver).getContext();
Set<String> contexts = ((AndroidDriver)driver).getContextHandles();
for (String context: contexts){
if (context.contains("NATIVE_APP")){
((AndroidDriver)driver).context(context);
break;
}
}
driver.findElement(By.id("android:id/button1")).click();
contexts = ((AndroidDriver)driver).getContextHandles();
for (String context: contexts){
if (context.contains("NATIVE_APP")){
((AndroidDriver)driver).context(context);
break;
}
}
driver.findElement(By.id("com.android.packageinstaller:id/permission_allow_button")).click();
((AndroidDriver)driver).context(webContext);
This helps allow all permissions required.

use webcam on a http website in google chrome

I am using webcam.js for getting a photo clicked of a customer for profile creation on my cloud based retail store software.
It used to work fine in earlier versions of chrome and is still working fine on firefox. But now latest version of chrome and even other browsers like Opera have started throwing errors on invoking webcam - only https versions are allowed to use webcam.
Its a personal use software and i don't want to spend extra on a SSL certificate. Is there some option where in we can add exception for a http site to use webcam
Current Code:
function loadCamera(){
Webcam.attach( '#my_camera' );
Webcam.set({
width: 200,
height: 200,
dest_width: 200,
dest_height: 200,
force_flash : true
});
}
You could check out letsencrypt or certbot (basically the same). They issue SSL certificates for free and the setup is very straightforward and easy.
Link:
https://letsencrypt.org/

Calling Rest service with json return, issue in chrome

I have a Rest service which if I execute it in IE or Firefox it executes fine.
http://MyPC.com/Services/REST.svc/Work/Lists?$format=json
But when I try to execute it in Chrome I just get this error.
http://MyPC.com/Services/REST.svc/Work/Lists?$format=json:1 GET http://MyPC.com/Services/REST.svc/Work/Lists?$format=json net::ERR_CONNECTION_RESET
Has anyone experienced this before and find a way to resolve it.
I've played around with the bindings in the config with no success
Just a note, I tried another Rest Service which I wasn't hosting and it worked in both IE and Chrome.
So it doesn't look like the issue is with Chrome.
I just want to add I didn't write any of these services, I'm still figuring it all out
Seems it sending the windows credentials through in binding did the trick, Chrome for some reason throws a connection issue when it didn't have the credentials for the service where as IE and Firefox seem to sk for the credentials when its required

Chrome : websocket connection not closed when browser closed

I am using Netty websockets and everything seems to work fine except this minor issue :
If I close the browser / tab of the js websocket client , the websocket connection is automatcally closed when using Mozilla firefox (currently using firefox 14) but the same thing does not happen in Chrome 20/21.
Anyone seen a similar issue / can anyone tell why is the connection not closed automatically ?
I guess I should have checked this earlier in the chromium bug section but I was not sure if it is a bug.
It has been reported earlier by someone and a chromium bug already exists :
Issue 51687 : WebSocket: Send close with code 1001 on reload / tab close
Update : Someone has submitted a patch to fix this issue, can be seen in the above link.
This may not be right, but I cannot post a comment to your question. Chrome/Chromium does not really close if you have an App running and have selected "Continue running background apps when Chromium is closed" from Settings-->Under the hood.
It may be that it treats the websocket connection as an app. Try looking at your running processes and kill any chrome/chromium process you find.
Again, this is just speculation on my part.
Chrome doesn't close the connection, when a user will close the window or browser.
It will trigger an Error event.
A possible workaround could look like this:
#OnError
public void onErr(Throwable t) {
onClose(this.container.getWsSession(), null);
}
But this will close the connection every time, an Error is triggered. You may wan't to check the throwable, before closing the connection by yourself.
For more discussion, please join this question:
Websocket: Closing browser triggers onError() in chrome but onClose() event in Firefox