Invite Token is Invalid, but it has actually expired

AI-generated summary

The discussion revolves around an issue with an invite token being reported as invalid. davidkingham shares that their invite link stopped working after successfully inviting 20 people, despite having a limit of 5000 invites. After investigating, JimPas suggests that the issue might be related to the invite expiry days setting, which is set to 30 days by default. davidkingham confirms that this was the issue and changing the setting fixes the problem.

However, the issue resurfaces, and davidkingham reports that the problem persists despite setting invite_expiry_days to 36500. techAPJ clarifies that the invite expiry days setting does not apply to multiple-use invite links, and the expiry timeline is set when generating the invite link, defaulting to 30 days.

After further investigation, davidkingham reveals that the invite was indeed set to expire a couple of days ago, despite their initial claim of setting it to 2099. Meanwhile, codinghorror suggests improving the error message to indicate that the token has expired rather than being invalid. techAPJ implements this change.

I have an invite link that has been working, I was able to invite 20 people successfully and then today it stopped working and I’m getting the ‘Your Invite Token is Invalid’ with the error in the console. I have the limit at 5000 invites. I can create a new invite and it works as expected. Any ideas? I’ve already sent the invite to a lot of people and would hate to have to send them a new code. I’m on latest tests passed.

Based on the path, the console errors are in a theme? Does this repro in safe mode? Can you repro the invite problem in incognito / anonymous mode in your browser?

What was the time span from when you created your token and it stopped working? I’m not sure if this setting will affect bulk invite tokens, but the default for user invite tokens is 30 days. I haven’t used bulk invitations, so I don’t know if there is a separate expiry time which will override this or not.
/admin/site_settings/category/users
invite expiry days 30
How long user invitation keys are valid, in days

Thank you Jim, I had missed that setting. This has fixed it. :+1:

@techapj can we improve this message so it says “Your invite token has expired” since that was the actual problem? “Invalid” doesn’t help us too much.

Oddly this problem has resurfaced again already. The console errors are coincidence as they do not show up in safe mode, but I do still get the invalid token error. I have invite_expiry_days set to 36500 now, which worked for a few days. I’m fine creating a new invite but I wanted to bring it up if anyone wants to look into it.

You are talking about (Superseded) Multiple Use Invite Links right? The “invite expiry days” setting does not apply on multiple use links. You are presented an option to set the expiry timeline at the time of generating invite link and it defaults to 30 days. You can see the expiry date for all the invite links on /u/username/invited/links page.

You’re right, I had set the expiry to 2099 on creation so I have no idea why changing that option made it work again, albeit briefly.

Improved error message via:

https://github.com/discourse/discourse/commit/ff44515a18bb9132aa6bd22c85d5a6a91f6efb70

I revoke my last comment, somehow the invite was set to expire a couple of days ago. I swear I did 2099, sorry! Thanks for the better message Arpit.