Invites keep getting error "not_matching_email"

AI-generated summary

The discussion revolves around an error “not_matching_email” when trying to redeem invites on a forum. EGreg shares a scenario where invites are sent, but upon clicking the link, users are logged in as a different user due to Single Sign-On (SSO) being enabled. Stephen identifies a bigger issue, where the external auth allows users to log in automatically, causing the invite email to be invalid. pfaffman reveals that the user is hardcoded in the SSO code for testing, which is causing the issue. The community is puzzled about how invites can be sent when SSO is enabled, which is expected to prevent invites from being created.

You can reproduce this bug yourself. I send out invites on a forum, and they arrive with a link like this:

https://forum.mycoralapp.com/invites/9pWS22fPc5?t=8a34feb15bc72e1582cf8460837548aa

You click the link, and see:

So far, so good. But then when I click Continue, I get:

I googled it and saw the only mention is in github language files for the repo. Looking up the key, I found this is the relevant code:

Somehow “email” is not empty, even though I am not logged in (try it yourself, in an incognito window). So where does “email” come from, in the code? Perhaps someone here would know.

Is the site setting normalize_emails enabled on this site?

And is DiscourseConnect still active on this site?

I thought that you couldn’t create invites if SSO was turned on. Did that get changed in that recent update to invites, @Falco ?

I tried it with regular emails too like foo@bar.com without +

I think your site has a bigger problem. If I click to log in I am automatically signed in as this user:

Invites shouldn’t be possible with SSO, and your external auth is letting users straight into the site. In that case the email is probably invalid because it’s comparing the email in the invite to the user above?

That’s it. The user is hard coded in the SSO code to test things so anyone who goes there is logged in as that user. So things see broken.

I’m still confused how you can send invites when sso is enabled.