corteza
corteza copied to clipboard
Opening records in a new browser tab sometimes brings you to the main screen of Compose
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:
- Go to a record list
- 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).
- 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
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.
Stale issue message
@Bojan-Svirkov I'm unable to recreate this error
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.
Ref for Too many requests and Internal error issue https://github.com/cortezaproject/corteza/issues/1037
Stale issue message
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.
I made a fix to the following issues on 2023.3.x-fix-auth-redirect-to-home
branch:
- Redirect to the home screen while the state is appended on the URL.
- Redirect to
/auth/oauth2/authorize
with aninvalid_request
error.
There are a couple of issues that are still present:
- 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 . - Redirect to
/auth/oauth2/authorize
with a blankinternal 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. Theinternal error
card with blank screen is thrown here: https://github.com/cortezaproject/corteza/blob/7bc36eb46f57cf1d8a271319f04c8ed5158eb7a7/server/auth/handlers/handler.go#L260-L262.