Mercurial > prosody-modules
diff mod_rest/README.markdown @ 3802:f88e07630e4e
mod_rest: Add support for simple Bearer token auth
Token specified in config
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 31 Dec 2019 03:37:46 +0100 |
parents | d59fb4dcf100 |
children | 02164f8aebac |
line wrap: on
line diff
--- a/mod_rest/README.markdown Mon Dec 30 07:22:15 2019 +0100 +++ b/mod_rest/README.markdown Tue Dec 31 03:37:46 2019 +0100 @@ -12,13 +12,11 @@ # Usage -Note that there is currently **no authentication**, so be careful with -exposing the API endpoint to the Internet. - ## Enabling ``` {.lua} Component "rest.example.net" "rest" +rest_credentials = "Bearer dmVyeSBzZWNyZXQgdG9rZW4K" ``` ## Sending stanzas @@ -30,6 +28,7 @@ ``` {.sh} curl https://prosody.example:5281/rest \ + --oauth2-bearer dmVyeSBzZWNyZXQgdG9rZW4K \ -H 'Content-Type: application/xmpp+xml' \ --data-binary '<message type="chat" to="user@example.org"> <body>Hello!</body> @@ -45,6 +44,7 @@ ``` {.sh} curl https://prosody.example:5281/rest \ + --oauth2-bearer dmVyeSBzZWNyZXQgdG9rZW4K \ -H 'Content-Type: application/xmpp+xml' \ --data-binary '<iq type="get" to="example.net"> <ping xmlns="urn:xmpp:ping"/> @@ -62,6 +62,7 @@ ``` {.lua} Component "rest.example.net" "rest" +rest_credentials = "Bearer dmVyeSBzZWNyZXQgdG9rZW4K" rest_callback_url = "http://my-api.example:9999/stanzas" ```