Mercurial > prosody-modules
comparison mod_rest/README.md @ 6430:cf5f0a20e16a
mod_rest: Fixup incorrect user auth docs
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 10 Mar 2026 16:13:25 +0100 |
| parents | ed6fa901cf94 |
| children | be2f75957552 |
comparison
equal
deleted
inserted
replaced
| 6429:66d7da6a9032 | 6430:cf5f0a20e16a |
|---|---|
| 44 component_secret = "dmVyeSBzZWNyZXQgdG9rZW4K" | 44 component_secret = "dmVyeSBzZWNyZXQgdG9rZW4K" |
| 45 ``` | 45 ``` |
| 46 | 46 |
| 47 ## User authentication | 47 ## User authentication |
| 48 | 48 |
| 49 To enable user authentication, edit the "admins = { }" section in prosody.cfg.lua, EG: | 49 Usernames are passed via HTTP Basic authentication, _without_ the `@virtualhost` part. |
| 50 | |
| 51 ```lua | |
| 52 admins = { "admin@chat.example.com" } | |
| 53 ``` | |
| 54 | |
| 55 To set up the admin user account: | |
| 56 | |
| 57 ```lua | |
| 58 prosodyctl adduser admin@chat.example.com | |
| 59 ``` | |
| 60 | |
| 61 and lastly, drop the "@host" from the username in your http queries, EG: | |
| 62 | 50 |
| 63 ```lua | 51 ```lua |
| 64 curl -sf \ | 52 curl -sf \ |
| 65 -H 'Accept: application/json' \ | 53 -H 'Accept: application/json' \ |
| 66 --user admin \ | 54 --user romeo \ |
| 67 https://chat.example.com:5281/rest/version/chat.example.com | 55 https://chat.example.com:5281/rest/version/chat.example.com |
| 68 ``` | 56 ``` |
| 69 | 57 |
| 70 ## OAuth2 | 58 ## OAuth2 |
| 71 | 59 |
