mirror of
https://github.com/friendica/friendica
synced 2025-04-23 13:50:11 +00:00
API: Tests with various clients, small fixes
This commit is contained in:
parent
fa2c8cad9d
commit
d917ed58a8
3 changed files with 41 additions and 6 deletions
|
@ -23,6 +23,7 @@ namespace Friendica\Module\OAuth;
|
|||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Post\Content;
|
||||
use Friendica\Module\BaseApi;
|
||||
use Friendica\Security\OAuth;
|
||||
|
||||
|
@ -88,6 +89,22 @@ class Authorize extends BaseApi
|
|||
DI::mstdnError()->UnprocessableEntity();
|
||||
}
|
||||
|
||||
DI::app()->redirect($application['redirect_uri'] . (strpos($application['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']]));
|
||||
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::session()->set('oauth_token_code', $token['code']);
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$code = DI::session()->get('oauth_token_code');
|
||||
DI::session()->remove('oauth_token_code');
|
||||
|
||||
if (empty($code)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return DI::l10n()->t('Please copy the following authentication code into your application and close this window: %s', $code);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue