Okta SSO bug to Sharefile if Sharefile was prior accessed directly in same Okta session

Hello there, we faced interesting bug, details are as follows:

Our web app uses okta single sign on (SSO) to different 3rd party services, one of them is Sharefile. However for convenience of our users we also for some pages address Sharefile directly to get and display some documents right on our web application.

Everything works fine on all our instances which use okta account without subdomains. On instances where we have got https://{subdomain}.okta.com there are few cases when sso bugs.

The problem takes place when on our web app instances which use okta with subdomains we trigger direct sharfile api calls and then in same okta session use okta sharefile app via sso. In such case somehow okta redirect takes place and we are redirected back to our web appliaction but not to Sharefile. When redirect bug takes place we no longer can reach Sharefile via okta sso. Needs to be said to overcome mentioned bug we can log out and log in our web app (to start a new okta session) after that we are able to reach sharefile via okta sso without any problems.

We use following url when addressing Sharefile directly - ‘https://{sharefile.url}/oauth/authorize?client_id={clientId}&state=&redirect_uri=${url}/documents&response_type=code’.

We will be grateful to hear any ideas how we can fix that.