Mercurial > prosody-modules
comparison mod_rest/example/rest.sh @ 5330:071d05b13a06
mod_rest/rest.sh: Update 'client_uri' to module page
This started as a convenience wrapper for httpie + mod_rest that
eventually grew OAuth support.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 07 Apr 2023 15:27:03 +0200 |
parents | 107d60c70c1a |
children | e28ba69b5307 |
comparison
equal
deleted
inserted
replaced
5329:107d60c70c1a | 5330:071d05b13a06 |
---|---|
67 OAUTH_META="$(http --check-status --json "https://$HOST/.well-known/oauth-authorization-server" Accept:application/json)" | 67 OAUTH_META="$(http --check-status --json "https://$HOST/.well-known/oauth-authorization-server" Accept:application/json)" |
68 AUTHORIZATION_ENDPOINT="$(echo "$OAUTH_META" | jq -e -r '.authorization_endpoint')" | 68 AUTHORIZATION_ENDPOINT="$(echo "$OAUTH_META" | jq -e -r '.authorization_endpoint')" |
69 if [ -z "${OAUTH_CLIENT_INFO:-}" ]; then | 69 if [ -z "${OAUTH_CLIENT_INFO:-}" ]; then |
70 # Register a new OAuth client | 70 # Register a new OAuth client |
71 REGISTRATION_ENDPOINT="$(echo "$OAUTH_META" | jq -e -r '.registration_endpoint')" | 71 REGISTRATION_ENDPOINT="$(echo "$OAUTH_META" | jq -e -r '.registration_endpoint')" |
72 OAUTH_CLIENT_INFO="$(http --check-status "$REGISTRATION_ENDPOINT" Content-Type:application/json Accept:application/json client_name=rest client_uri="https://www.zash.se/rest-script.html" redirect_uris:='["urn:ietf:wg:oauth:2.0:oob"]')" | 72 OAUTH_CLIENT_INFO="$(http --check-status "$REGISTRATION_ENDPOINT" Content-Type:application/json Accept:application/json client_name=rest client_uri="https://modules.prosody.im/mod_rest" redirect_uris:='["urn:ietf:wg:oauth:2.0:oob"]')" |
73 mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/rest/" | 73 mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/rest/" |
74 typeset -p OAUTH_CLIENT_INFO >> "${XDG_CACHE_HOME:-$HOME/.cache}/rest/$HOST" | 74 typeset -p OAUTH_CLIENT_INFO >> "${XDG_CACHE_HOME:-$HOME/.cache}/rest/$HOST" |
75 fi | 75 fi |
76 | 76 |
77 CLIENT_ID="$(echo "$OAUTH_CLIENT_INFO" | jq -e -r '.client_id')" | 77 CLIENT_ID="$(echo "$OAUTH_CLIENT_INFO" | jq -e -r '.client_id')" |