Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grist Forms - Redirecting loop error #966

Open
s-karrer opened this issue May 6, 2024 · 8 comments · Fixed by #1020
Open

Grist Forms - Redirecting loop error #966

s-karrer opened this issue May 6, 2024 · 8 comments · Fixed by #1020

Comments

@s-karrer
Copy link

s-karrer commented May 6, 2024

Hello, i am working with Grist Forms and found a bug when i want to access a published form.

Problem

I get a redirecting loop error accessing the forms link : http://localhost:9999/forms/47QFRwq6wLjhGTYaUAckWG/4

image

This bug came up when using Grist Omnibus with email/password authentication and you have a logged in session.
(Grist Version 1.1.13)

The log output:

2024-05-06 07:20:27.067 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.095 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.119 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.155 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.209 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.251 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.288 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.319 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.350 - debug: Authorizer: redirecting to log in
2024-05-06 07:20:27.378 - debug: Authorizer: redirecting to log in

Solution

I figured out that the formMiddleware is missing some redirects as you can see here:

formMiddleware: [
forcedLoginMiddleware,
],

When adding the redirects used for docMiddleware, it is working fine:

formMiddleware: [
        this._redirectToHostMiddleware,
        this._userIdMiddleware,
        forcedLoginMiddleware,
        this._redirectToOrgMiddleware,
        welcomeNewUser
      ],

If I use Grist only instead of Grist Omnibus it is working but I dont know why maybe because no authentication and redirect is happening. Also the form access link is different: http://localhost:8484/o/docs/forms/5jzQzr3NL8tYwALbBcJkBz/4

I am not into that code base so maybe someone can have a closer look.
Is this fix valid or do i miss something and the fix should be in my Omnibus setup?

@thinkbig1979
Copy link

thinkbig1979 commented May 27, 2024

Having a similar issue with forms. I'm using zitadel OIDC SSO, which is working with Grist otherwise, only forms seem to have a problem. Here's the console output:
image

On the Zitadel side, this is all the log shows:
image

@fflorent
Copy link
Collaborator

fflorent commented Jun 5, 2024

Do you really need GRIST_FORCE_LOGIN to be set? Quoting the documentation:

Much like GRIST_ANON_PLAYGROUND but don't support anonymous access at all (features like sharing docs publicly requires authentication)

Or would GRIST_ANON_PLAYGROUND=false fit your need?
AFAICT, with this option, the forms work.

@thinkbig1979
Copy link

Thanks @fflorent, thanks for your comment, but I do not want the forms to be publicly accessible, and this problem occurs both when users are logged in prior to trying to access the form or when they go to the form url and are sent to the login page. As soon as they are logged in, this error occurs.
The docs say this about FORCE_LOGIN, and that is what I want to happen, as I do not want anonymous users in the system at all. So as far as I can tell, that setting is correct.

GRIST_FORCE_LOGIN: (optional) when set to true this will instruct Grist to redirect anonymous users to a login page.

@paulfitz
Copy link
Member

paulfitz commented Jun 5, 2024

This turns out to be easy to replicate in grist-omnibus, local setup, default example in README. Parallel thread in forum here: https://community.getgrist.com/t/forms-not-working-on-self-hosted-grist/5212

@paulfitz
Copy link
Member

paulfitz commented Jun 5, 2024

@georgegevoian and @berhalak I'd appreciate your eyes on this issue [when you're available obviously, otherwise enjoy your respective vacations :-)].

@georgegevoian
Copy link
Contributor

@s-karrer thanks for digging into the problem. Can you confirm that adding just this._userIdMiddleware to formMiddleware addresses your issue? (That fix should be landing shortly.)

@georgegevoian
Copy link
Contributor

A fix has now landed in grist-omnibus. It's also in the latest grist-core image, and will be included in the next versioned release (1.1.15).

Let us know if you run into any issues. Thanks!

@s-karrer
Copy link
Author

s-karrer commented Jun 6, 2024

@s-karrer thanks for digging into the problem. Can you confirm that adding just this._userIdMiddleware to formMiddleware addresses your issue? (That fix should be landing shortly.)

Yes just adding this._userIdMiddleware is working fine. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants