corteza icon indicating copy to clipboard operation
corteza copied to clipboard

Opening records in a new browser tab sometimes brings you to the main screen of Compose

Open Bojan-Svirkov opened this issue 2 years ago • 8 comments

Reported by: Lenny Horstink

Opening records in a new browser tab sometimes brings you to the main screen of Compose. Not always, but sometimes. It seems random.

This happened to people in our sales team and I can confirm it happened to me as well.

Steps to reproduce:

  1. Go to a record list
  2. Open the record in a new tab (with a middle-mouse click on the record edit button, or simply on the record if opening in a new tab is enabled).
  3. If it opens ok, try again.

Brian sent me a video of it.

https://user-images.githubusercontent.com/53232926/201364767-71dec913-b712-4529-b971-8b2f42a83016.mov

Bojan-Svirkov avatar Nov 11 '22 14:11 Bojan-Svirkov

In 20 clicks or so this only occurred once for me, so yup it is pretty random and after that I wasn't able to reproduce it. If I tried to open couple records with the middle-mouse click they were not opening and I was receiving either internal error, too many requests or invalid_request, but probably that is another issue. I will attach a picture of the error messages. If that is another issue and if it is not the expected behavior @darh let me know and I will create a card for it.

Image

Bojan-Svirkov avatar Nov 11 '22 14:11 Bojan-Svirkov

Stale issue message

github-actions[bot] avatar Jan 11 '23 06:01 github-actions[bot]

@Bojan-Svirkov I'm unable to recreate this error

kelanik8 avatar Mar 01 '23 13:03 kelanik8

There is still going on something in this ticket, I was able to reproduce this but maybe in a 100 tabs opened, which is really edge case. And since when you click new tab really fast, you can receive the internal error pretty often. So let's keep this card for now.

Bojan-Svirkov avatar Mar 02 '23 14:03 Bojan-Svirkov

Ref for Too many requests and Internal error issue https://github.com/cortezaproject/corteza/issues/1037

katrinDY avatar Mar 31 '23 11:03 katrinDY

Stale issue message

github-actions[bot] avatar Jul 08 '23 06:07 github-actions[bot]

The issue occurs in every web app when clicking a link that opens in a new tab. If the link is clicked multiple times, some tabs take you to the home screen with the auth state still appened on the URL, while other tabs that are on the desired page, don't have the auth state. Upon investigation, I believe the issue lies in how the front end handles the redirection after a successful authentication process.

KinyaElGrande avatar Jul 27 '23 07:07 KinyaElGrande

I made a fix to the following issues on 2023.3.x-fix-auth-redirect-to-home branch:

  1. Redirect to the home screen while the state is appended on the URL.
  2. Redirect to /auth/oauth2/authorize with an invalid_request error.

There are a couple of issues that are still present:

  1. When multiple tabs are opened at the same time, some tabs redirect back to the home screen but without the auth state appended on the URL. Something noted about the tabs that are on the home screen is it has two auth states. A possible cause for this behavior could be how backend sessions have been implemented which was discovered after logging both the request's state and session's state on the following line https://github.com/cortezaproject/corteza/blob/2023.3.x/server/auth/handlers/handle_oauth2.go#L38 .
  2. Redirect to /auth/oauth2/authorize with a blank internal error card. This error happens when https://github.com/cortezaproject/corteza/blob/2023.3.x/server/auth/handlers/handle_oauth2.go#L37 is called only once and the session is nil or when the session's state is not the same as request's state. The internal error card with blank screen is thrown here: https://github.com/cortezaproject/corteza/blob/7bc36eb46f57cf1d8a271319f04c8ed5158eb7a7/server/auth/handlers/handler.go#L260-L262.

KinyaElGrande avatar Aug 28 '23 14:08 KinyaElGrande