Create users with pre-determined password

Good day, dear team,

Thanks for your constant devotion to the redash product. Currently we are using it as a dashboard in our intenal network. It really helps us a lot.

The issue is the network is isolated and we cant send email verification to the user.

I wonder if we have a simpler way to create users such as inserting the username, email to the database?

Thanks in advance.

You canā€™t insert usernames and passwords directly, but you can do this with the API. Each user requires two requests:

First Request: create a new user

Do this with a POST request to baseurl/api/users?no_invite. Your request should include a JSON object with name and email keys. The no_invite querystring variable forces Redash to return an invite_link in the response.

Second Request: Push a password

POST to the invite_link URL from the first request. This network request should be multi-part form encoded with a single key: password.

Commentary

Iā€™d avoid forcing the passwords with the second request. Itā€™s probably sufficient to make the first network request, note the invite_link and share that with your users through some internal system. But thatā€™s up to you.

Thanks for your instant response, much appreciated! :clap:

1 Like

I tried the way you said but Iā€™m getting a message as ā€œCouldnā€™t find resource. Please login and try again.ā€

Here is the screenshot from postman.

I fixed it by creating user from cli.

The CLI can do it to :slight_smile: But thereā€™s no reason you canā€™t do it via the API. I suspect you received an error because you didnā€™t include an Authorization header in your HTTP request.

curl --header ā€œContent-Type: application/jsonā€ --request POST --data ā€˜{ā€œemailā€: ā€œmail_accountā€, ā€œnameā€: ā€œuser_nameā€}ā€™ ā€˜https://link_redash/api/users?no_inviteā€™ --header ā€œAuthorization: API_KEYā€