Generating lots of Invite Tokens


There was a misunderstanding about what the tokens do. They won’t solve Robert’s issue unfortunately.


(Christoph) #23

Any chance that public invite tokens will become available? I’m imagining that all it would take is

  1. to allow (certain) tokens to be reused
  2. to make discourse accept those tokens without the email part and instead allow users to enter it on the invite-signup page.

(Robert) #24

@techAPJ @HAWK is correct but as a team you guys are #1

I hope they become available but have no understanding of the complexity,

I do question if a link could be created from a user that might in turn create random tokens when clicked that accomplish,

1, The invite
2, Credit to the poster

BTW I’m thinking we need a return rocket from Mars while you guys are on it :+1:

1 Like


We could also make good use of this if it’s “on the fence” dev wise.

1 Like


@pfaffman Hi Jay, I’m getting the error noted below when attempting to generate tokens. Any tips? Using either my username or my admin email address in the username field on line 13 of disposable_invite_tokens.rb generates the same error. Could it be due to the fact that the domain associated with the email used in the file


differs from my domain name? If so, what are the next steps to getting tokens generated?

Note: Alternatively, could it be because I’m using a recently released gTLD for my domain and there’s some formatting validation going on?

/Users/mmm/discourse_api/lib/discourse_api/client.rb:149:in `handle_error': {"errors"=>["Email is invalid"], "error_type"=>"record_invalid"} (DiscourseApi::UnprocessableEntity)
from /Users/mmm/discourse_api/lib/discourse_api/client.rb:136:in `request'
from /Users/mmm/discourse_api/lib/discourse_api/client.rb:87:in `post'
from /Users/mmm/discourse_api/lib/discourse_api/api/invite.rb:14:in `disposable_tokens'
from disposable_invite_tokens.rb:13:in `<main>'

(Jeff Atwood) #27

What is the full domain name?



Hi Jeff, it’s


(Jay Pfaffman) #29

Oh, **that’s"" why you’re asking me! Sorry I didn’t recognize your username.

It’s not recognized as a URL when you put it here. That seems like a reasonable hypothesis. I’ll try to have a look into the source later today.

Edit: it would make sense if the unrecognized domain were in the email address, but not the site hostname. Have you tried with just one or two addresses?

1 Like

(Jay Pfaffman) #30

The error that’s in the Rails logs is this:

Processing by DiscourseInviteTokens::InviteTokensController#create_invite_token as JSON
  Parameters: {"quantity"=>"5", "username"=>"pfaffman"}
Can't verify CSRF token authenticity.
Completed 422 Unprocessable Entity in 33ms (Views: 0.2ms | ActiveRecord: 16.1ms)

It looks like the Gem just claims that “unprocessable entity” is “email is invalid”. I don’t think that there is an invalid email anywhere.

1 Like