diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-04 20:58:19 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-05-04 20:58:19 -0700 |
commit | 67918033f94e277240a826534f03ed6d13e4be9d (patch) | |
tree | fa4dee9c0bd5dc1125bfc16df31eb39058221a0f /include | |
parent | faf98147882857f09ed5bdb694bebaae416b2526 (diff) | |
download | volse-hubzilla-67918033f94e277240a826534f03ed6d13e4be9d.tar.gz volse-hubzilla-67918033f94e277240a826534f03ed6d13e4be9d.tar.bz2 volse-hubzilla-67918033f94e277240a826534f03ed6d13e4be9d.zip |
oauth2 dynamic client registration
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/include/api.php b/include/api.php index 693967696..c91590070 100644 --- a/include/api.php +++ b/include/api.php @@ -194,15 +194,25 @@ require_once('include/api_zot.php'); else $redirect = trim($_REQUEST['redirect_uris']); $icon = trim($_REQUEST['logo_uri']); - $r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid) - VALUES ('%s','%s','%s','%s','%s',%d)", - dbesc($key), - dbesc($secret), - dbesc($name), - dbesc($redirect), - dbesc($icon), - intval(0) - ); + if($oauth2) { + $r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id) + VALUES ( '%s', '%s', '%s', null, null, null ) ", + dbesc($key), + dbesc($secret), + dbesc($redirect) + ); + } + else { + $r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid) + VALUES ('%s','%s','%s','%s','%s',%d)", + dbesc($key), + dbesc($secret), + dbesc($name), + dbesc($redirect), + dbesc($icon), + intval(0) + ); + } $ret['client_id'] = $key; $ret['client_secret'] = $secret; |