# HG changeset patch # User Ben Smith # Date 1715697094 25200 # Node ID dcea4b4c415d8e17c13a5cd809e4cf61bc163491 # Parent d194d1012fd398b6894b8725b0256fe453adfbb5 Tweaking documentation to clarify that Oauth2 can be used for VirtualHosts and Component installations. diff -r d194d1012fd3 -r dcea4b4c415d mod_rest/README.markdown --- a/mod_rest/README.markdown Mon May 13 13:25:13 2024 -0700 +++ b/mod_rest/README.markdown Tue May 14 07:31:34 2024 -0700 @@ -21,7 +21,8 @@ # Usage -You make a choice: install via VirtualHosts or as a Component. +You make a choice: install via VirtualHosts or as a Component. User authentication can +be used when installed via VirtualHost, and OAuth2 can be used for either. ## On VirtualHosts @@ -34,7 +35,18 @@ modules_enabled = {"rest"} ``` -### User authentication +## As a Component + +If you install this as a component, you won't be able to use user authentication above, +and must use OAuth2 authentication outlined below. + +``` {.lua} +Component "chat.example.com" "rest" +component_secret = "dmVyeSBzZWNyZXQgdG9rZW4K" +modules_enabled = {"http_oauth2"} +``` + +## User authentication To enable user authentication, edit the "admins = { }" section in prosody.cfg.lua, EG: @@ -58,18 +70,7 @@ -H 'Accept: application/json' ``` -## As a Component - -If you install this as a component, you won't be able to use user authentication above, -and must use OAuth2 authentication outlined below. - -``` {.lua} -Component "chat.example.com" "rest" -component_secret = "dmVyeSBzZWNyZXQgdG9rZW4K" -modules_enabled = {"http_oauth2"} -``` - -### OAuth2 +## OAuth2 [mod_http_oauth2] can be used to grant bearer tokens which are accepted by mod_rest. Tokens can be passed to `curl` like `--oauth2-bearer