Self hosted Elastic App Search add user via invitation not working

I have set up Elastic App Search in standard security mode.

Configuration picked from below document -

Also configured mailer so I am able to get invitation mail.

After submitting the create account form getting Authentication has failed error.

Logs on console -

appsearch_1      | [2020-01-10T12:49:24.958+00:00][13][2284][app-server][INFO]: [81d2d6bf-cd7e-4d29-956b-55c9783dd068] Started POST "/authenticate/accept_invitation" for 172.23.0.1 at 2020-01-10 12:49:24 +0000
appsearch_1      | [2020-01-10T12:49:24.990+00:00][13][2284][action_controller][INFO]: [81d2d6bf-cd7e-4d29-956b-55c9783dd068] Processing by AuthenticateController#accept_invitation as */*
appsearch_1      | [2020-01-10T12:49:24.995+00:00][13][2284][action_controller][INFO]: [81d2d6bf-cd7e-4d29-956b-55c9783dd068]   Parameters: {"auth_strategy"=>"elasticsearch_standard", "user"=>{"password"=>"[FILTERED]"}, "lm_invitation_code"=>"hCYBOH9KuGvbgVQmOgUaQA", "host"=>"localhost:3002", "protocol"=>"http"}
appsearch_1      | [2020-01-10T12:49:25.063+00:00][13][2284][action_view][INFO]: [81d2d6bf-cd7e-4d29-956b-55c9783dd068]   Rendered text template (0.2ms)
appsearch_1      | [2020-01-10T12:49:25.066+00:00][13][2284][action_controller][INFO]: [81d2d6bf-cd7e-4d29-956b-55c9783dd068] Completed 403 Forbidden in 69ms (Views: 10.3ms)

Please guide to make this working.

Thank you.

Hi @abhishek.haith :wave:

From what I can tell this should only happen if the underlying Elasticsearch user has been deleted. What happens is that when App Search creates the invite it also creates the underlying Elasticsearch user.
Can you verify if that user still exists as an Elasticsearch user with the Get Users API?

Hello @orhantoy

Thanks for giving idea how App Search manages users.

I checked the particular user in Elasticsearch with Get User API

Found what is the actual issue.

I created the user with below information

Email: john.doe@example.com
Username: John Doe
Role: Admin

App Search created user in Elasticsearch like below

{
    "John+Doe":
    {
        "username": "John+Doe",
        "roles": [],
        "full_name": "John Doe",
        "email": "john.doe@example.com",
        "metadata":
        {
            "created_by_app_search": true
        },
        "enabled": false
    }
}

I think user lookup getting failed when username has space in it.

Can we put validation on Username field in invitation form?
Or add this info in the documentation to avoid space in Username field?

Thank you.

1 Like

Awesome and very helpful debugging! :clap:
We'll try to get that sorted out for the next release.

1 Like

Great :clap:

Thank you :smiley:

@abhishek.haith This should now be fixed in today's 7.5.2 release.

Hi @orhantoy

I have tried to create a user with space in Username on App Search Docker v7.5.2 and it worked! :smiley: :clap:

Thank you :slight_smile: