diff mod_auth_oauth_external/mod_auth_oauth_external.lua @ 5436:e7d99bacd0e8

mod_auth_oauth_external: Make 'scope' configurable in password grant request Needed by some OAuth servers, tested here with Mastodon
author Kim Alvefur <zash@zash.se>
date Wed, 10 May 2023 12:39:05 +0200
parents b3e7886fea6a
children 49306afbf722
line wrap: on
line diff
--- a/mod_auth_oauth_external/mod_auth_oauth_external.lua	Mon May 08 20:12:43 2023 +0200
+++ b/mod_auth_oauth_external/mod_auth_oauth_external.lua	Wed May 10 12:39:05 2023 +0200
@@ -17,6 +17,7 @@
 -- the OAuth client? Is the XMPP client the OAuth client? What are we???
 local client_id = module:get_option_string("oauth_external_client_id");
 local client_secret = module:get_option_string("oauth_external_client_secret");
+local scope = module:get_option_string("oauth_external_scope", "openid");
 
 --[[ More or less required endpoints
 digraph "oauth endpoints" {
@@ -44,7 +45,7 @@
 					client_secret = client_secret;
 					username = map_username(username, realm);
 					password = password;
-					scope = "openid";
+					scope = scope;
 				});
 			}))
 			if err or not (tok.code >= 200 and tok.code < 300) then