'Java: Is there any way to get context of single sign on done on local system through code?

My company uses multiple applications and single sign on using Microsoft login.

In my browser, I already login to application but when run incognito mode, it again ask for login and MFA.

Now i want to download the image in that application

try(InputStream in = new URL("https://bhuwhatwhere.tie.com/EmployeeImages/Profiles/AAHLENIU.jpg").openStream()){
        Files.copy(in, Paths.get("C://Integrator//AAHLENIU.jpg"));
    }

It returns on my local:

Copyright (C) Microsoft Corporation. All rights reserved. --><!DOCTYPE html><html dir="ltr" class="" lang="en"><head> <title>Sign in to your account</title>
All these url's return microsoft sign in page.

Is there way to download file using same browser contexts; either doing some registry changes (or do i need oauth etc.)? Because there are 4000 images and download single is mess.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source