]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/OAuth/Authorize.php
Remove DI dependency from Module\Contact\Profile
[friendica.git] / src / Module / OAuth / Authorize.php
index 973f31a0b185d9c0a822fecc573f91b12631898a..ea91de5a045d70f8fd8b4d9be74bb51edde0715b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -39,7 +39,7 @@ class Authorize extends BaseApi
         */
        protected function rawContent(array $request = [])
        {
-               $request = self::getRequest([
+               $request = $this->getRequest([
                        'force_login'   => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance.
                        'response_type' => '', // Should be set equal to "code".
                        'client_id'     => '', // Client ID, obtained during app registration.
@@ -70,7 +70,7 @@ class Authorize extends BaseApi
                unset($redirect_request['pagename']);
                $redirect = 'oauth/authorize?' . http_build_query($redirect_request);
 
-               $uid = local_user();
+               $uid = DI::userSession()->getLocalUserId();
                if (empty($uid)) {
                        Logger::info('Redirect to login');
                        DI::app()->redirect('login?return_path=' . urlencode($redirect));
@@ -91,7 +91,7 @@ class Authorize extends BaseApi
                }
 
                if ($application['redirect_uri'] != 'urn:ietf:wg:oauth:2.0:oob') {
-                       DI::app()->redirect($application['redirect_uri'] . (strpos($application['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']]));
+                       DI::app()->redirect($request['redirect_uri'] . (strpos($request['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']]));
                }
 
                self::$oauth_code = $token['code'];