changeset 5430:48c643c851f3

mod_rest/rest.sh: Make scopes to request configurable in restrc Makes it easier to experiment with requesting various scopes and roles
author Kim Alvefur <zash@zash.se>
date Sun, 07 May 2023 20:41:35 +0200
parents 0bbeee8ba8b5
children 95cb7e7efa37
files mod_rest/example/rest.sh
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/example/rest.sh	Sun May 07 20:25:18 2023 +0200
+++ b/mod_rest/example/rest.sh	Sun May 07 20:41:35 2023 +0200
@@ -89,7 +89,7 @@
 
 	if [ -z "${ACCESS_TOKEN:-}" ]; then
 		CODE_CHALLENGE="$(head -c 33 /dev/urandom | base64 | tr /+ _-)"
-		open "$AUTHORIZATION_ENDPOINT?response_type=code&client_id=$CLIENT_ID&code_challenge=$CODE_CHALLENGE&scope=openid+prosody:user"
+		open "$AUTHORIZATION_ENDPOINT?response_type=code&client_id=$CLIENT_ID&code_challenge=$CODE_CHALLENGE&scope=${SCOPE:-openid+prosody:user}"
 		read -p "Paste authorization code: " -s -r AUTHORIZATION_CODE
 
 		TOKEN_RESPONSE="$(http --check-status --form "$TOKEN_ENDPOINT" 'grant_type=authorization_code' "client_id=$CLIENT_ID" "client_secret=$CLIENT_SECRET" "code=$AUTHORIZATION_CODE" code_verifier="$CODE_CHALLENGE")"