aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-04-04 20:58:54 -0700
committerzotlabs <mike@macgirvin.com>2018-04-04 20:58:54 -0700
commitc86032d4dc0e3396a03d8bcc8eef25d9191f3cfc (patch)
treeee02c6ad772837bbb9fcf75993d54c6b4849573f
parente8646799427a51a13e97f83a7858274fbf85ba20 (diff)
downloadvolse-hubzilla-c86032d4dc0e3396a03d8bcc8eef25d9191f3cfc.tar.gz
volse-hubzilla-c86032d4dc0e3396a03d8bcc8eef25d9191f3cfc.tar.bz2
volse-hubzilla-c86032d4dc0e3396a03d8bcc8eef25d9191f3cfc.zip
oauth2 dynamic client registration update
-rw-r--r--include/api.php30
1 files changed, 11 insertions, 19 deletions
diff --git a/include/api.php b/include/api.php
index c91590070..6a05a40a5 100644
--- a/include/api.php
+++ b/include/api.php
@@ -193,26 +193,18 @@ require_once('include/api_zot.php');
$redirect = trim($_REQUEST['redirect_uris'][0]);
else
$redirect = trim($_REQUEST['redirect_uris']);
+ $grant_types = trim($_REQUEST['grant_types']);
+ $scope = trim($_REQUEST['scope']);
$icon = trim($_REQUEST['logo_uri']);
- 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)
- );
- }
+ $r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id)
+ VALUES ( '%s', '%s', '%s', '%s', '%s', '%s' ) ",
+ dbesc($key),
+ dbesc($secret),
+ dbesc($redirect),
+ dbesc($grant_types),
+ dbesc($scope),
+ dbesc((string) api_user())
+ );
$ret['client_id'] = $key;
$ret['client_secret'] = $secret;